-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (89 loc) · 2.74 KB
/
deploy_worker.yml
File metadata and controls
92 lines (89 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Deploy worker
on:
workflow_call:
inputs:
os:
required: true
type: string
description: The OS to run on.
pytest-debug:
required: false
type: string
description: Set this to make pytest emit debug logs.
python-version:
required: true
type: string
description: The python version to run.
permissions:
contents: write
jobs:
update_semver_tags:
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}
cache: 'pip'
- run: pip install twine
- name: Debugging
run: |
type -P grep
grep -P "" Makefile || echo "-P unsupported"
type -P tr
type -P cut
type -P cat
- name: Check that the python version in the code matches the tag
run: |
REPO_VERSION=$(make version)
if [ "refs/tags/v$REPO_VERSION" != "${{ github.ref }}" ]; then
echo "Declared version in repository does not match tag '${{ github.ref }}'"
exit 1
fi
- run: make publish_git_tags
publish_to_test_pypi:
runs-on: ${{ inputs.os }}
needs: update_semver_tags
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}
cache: 'pip'
- name: Publish to test PyPi
run: make publish_test_pypi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_KEY }}
- name: Notify alerts channel of failure
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2.2.1
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_COLOR: ${{ job.status }}
SLACK_TITLE: Failure Message
MSG_MINIMAL: actions url, commit, ref
SLACK_FOOTER: Build failure
publish_to_prod_pypi:
runs-on: ${{ inputs.os }}
needs: publish_to_test_pypi
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}
cache: 'pip'
- name: Publish to test PyPi
run: make publish_prod_pypi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_KEY }}
- name: Notify alerts channel of failure
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2.2.1
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_COLOR: ${{ job.status }}
SLACK_TITLE: Failure Message
MSG_MINIMAL: actions url, commit, ref
SLACK_FOOTER: Build failure