Skip to content

Commit 2e5dceb

Browse files
authored
Update build process
1 parent 915daca commit 2e5dceb

2 files changed

Lines changed: 43 additions & 62 deletions

File tree

.github/workflows/build.yml

Lines changed: 26 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3-
41
name: CI
52

63
on:
@@ -14,81 +11,58 @@ concurrency:
1411
group: mailosaur-python
1512
cancel-in-progress: true
1613

14+
permissions:
15+
contents: read
16+
1717
jobs:
1818
build:
19-
runs-on: ubuntu-latest
19+
name: Build (${{ matrix.environment }})
20+
runs-on: ${{ vars.LINUX }}
2021
timeout-minutes: 10
2122
strategy:
23+
fail-fast: false
2224
max-parallel: 1
2325
matrix:
24-
python-version: ["3.9"]
26+
environment: [live, next]
2527

2628
env:
27-
MAILOSAUR_BASE_URL: https://mailosaur.com/
28-
MAILOSAUR_SMTP_HOST: mailosaur.net
29+
MAILOSAUR_BASE_URL: ${{ matrix.environment == 'live' && 'https://mailosaur.com/' || 'https://next.mailosaur.com/' }}
30+
MAILOSAUR_SMTP_HOST: ${{ matrix.environment == 'live' && 'mailosaur.net' || 'mailosaur.email' }}
2931
MAILOSAUR_SMTP_PORT: 2525
3032
MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }}
3133
MAILOSAUR_SERVER: ${{ secrets.MAILOSAUR_SERVER }}
3234
MAILOSAUR_VERIFIED_DOMAIN: ${{ secrets.MAILOSAUR_VERIFIED_DOMAIN }}
3335

3436
steps:
35-
- uses: actions/checkout@v2
36-
- name: Set up Python ${{ matrix.python-version }}
37+
- name: Checkout source code
38+
uses: actions/checkout@v4
39+
- name: Set up Python
3740
uses: actions/setup-python@v4
3841
with:
39-
python-version: ${{ matrix.python-version }}
42+
python-version: ${{ vars.PYTHON_VERSION }}
4043
- name: Install dependencies
4144
run: |
4245
python -m pip install --upgrade pip
4346
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
4447
- name: Test with pytest
4548
run: |
4649
pytest
47-
- name: Notify on Failure
48-
uses: skitionek/notify-microsoft-teams@master
49-
if: ${{ failure() }}
50-
with:
51-
webhook_url: ${{ secrets.TEAMS_BUILDS_WEBHOOK }}
52-
needs: ${{ toJson(needs) }}
53-
job: ${{ toJson(job) }}
54-
overwrite: "{ title: `${workflow} failed for ${repository.name}` }"
5550
56-
build-next:
51+
notify:
52+
name: Notify
5753
if: ${{ always() }}
5854
needs: build
59-
runs-on: ubuntu-latest
60-
timeout-minutes: 10
61-
strategy:
62-
max-parallel: 1
63-
matrix:
64-
python-version: ["3.9"]
65-
66-
env:
67-
MAILOSAUR_BASE_URL: https://next.mailosaur.com/
68-
MAILOSAUR_SMTP_HOST: mailosaur.email
69-
MAILOSAUR_SMTP_PORT: 2525
70-
MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }}
71-
MAILOSAUR_SERVER: ${{ secrets.MAILOSAUR_SERVER }}
72-
MAILOSAUR_VERIFIED_DOMAIN: ${{ secrets.MAILOSAUR_VERIFIED_DOMAIN }}
73-
55+
runs-on: ${{ vars.LINUX }}
56+
7457
steps:
75-
- uses: actions/checkout@v2
76-
- name: Set up Python ${{ matrix.python-version }}
77-
uses: actions/setup-python@v4
58+
- name: Checkout custom actions
59+
uses: actions/checkout@v4
7860
with:
79-
python-version: ${{ matrix.python-version }}
80-
- name: Install dependencies
81-
run: |
82-
python -m pip install --upgrade pip
83-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
84-
- name: Test with pytest
85-
run: |
86-
pytest
87-
- name: Notify on Failure
88-
uses: skitionek/notify-microsoft-teams@master
89-
if: ${{ failure() }}
61+
repository: mailosaur/actions
62+
token: ${{ secrets.CUSTOM_ACTIONS_TOKEN }}
63+
path: .github/actions
64+
- name: Send notifications
65+
uses: ./.github/actions/notify
9066
with:
91-
webhook_url: ${{ secrets.TEAMS_BUILDS_WEBHOOK }}
92-
needs: ${{ toJson(needs) }}
93-
job: ${{ toJson(job) }}
94-
overwrite: "{ title: `${workflow} failed for ${repository.name}` }"
67+
webhook-url: ${{ secrets.NOTIFICATION_URL }}
68+
data: '{"matrixBuildResult": "${{ needs.build.result }}"}'

.github/workflows/publish.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,27 @@ on:
44
release:
55
types: [created]
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
publish:
9-
runs-on: ubuntu-latest
12+
runs-on: ${{ vars.LINUX }}
1013
timeout-minutes: 10
1114

1215
steps:
13-
- uses: actions/checkout@v2
16+
- name: Checkout source code
17+
uses: actions/checkout@v4
18+
- name: Checkout custom actions
19+
uses: actions/checkout@v4
20+
with:
21+
repository: mailosaur/actions
22+
token: ${{ secrets.CUSTOM_ACTIONS_TOKEN }}
23+
path: .github/actions
1424
- name: Set up Python
1525
uses: actions/setup-python@v4
1626
with:
17-
python-version: "3.9"
27+
python-version: ${{ vars.PYTHON_VERSION }}
1828
- name: Install dependencies
1929
run: |
2030
python -m pip install --upgrade pip
@@ -32,11 +42,8 @@ jobs:
3242
run: |
3343
python setup.py sdist bdist_wheel
3444
twine upload dist/*
35-
- name: Notify on Failure
36-
uses: skitionek/notify-microsoft-teams@master
37-
if: ${{ failure() }}
45+
- name: Send notifications
46+
if: ${{ always() }}
47+
uses: ./.github/actions/notify
3848
with:
39-
webhook_url: ${{ secrets.TEAMS_BUILDS_WEBHOOK }}
40-
needs: ${{ toJson(needs) }}
41-
job: ${{ toJson(job) }}
42-
overwrite: "{ title: `${workflow} failed for ${repository.name}` }"
49+
webhook-url: ${{ secrets.NOTIFICATION_URL }}

0 commit comments

Comments
 (0)