-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (87 loc) · 3 KB
/
deploy.yml
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
93
94
95
96
97
98
99
100
101
102
name: Deploy SDK
on:
release:
types:
- published
jobs:
deploy_pre_release:
name: Deploy Client Pre-Release to PYPI
if: ${{ github.event.release.prerelease }}
runs-on: ubuntu-latest
steps:
- name: Set Release Version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Check Release Tag Format
run: |
re=[0-9]+\.[0-9]+\.[0-9]+b[0-9]+
if ! [[ $RELEASE_VERSION =~ $re ]]; then
echo 'Tag does not match expected regex pattern for beta releases (v[0-9]+.[0-9]+.[0-9]+b[0-9]+)'
echo $RELEASE_VERSION
echo 'Please update your tag to match the expected regex pattern'
exit 1
fi
- name: Checkout
uses: actions/checkout@v4
with:
ref: feature/openapi-generator-sdk
- name: Install Packages
run: |
pip install -r requirements.txt
pip install -r test-requirements.txt
- name: Test
run: |
pytest -v
- name: Deploy to PYPI
run: |
pip install twine
pip install wheel
python setup.py sdist bdist_wheel
twine upload dist/* -u __token__ -p $PYPI_API_KEY
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
- uses: Bandwidth/[email protected]
if: always()
with:
job-status: ${{ job.status }}
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel: ${{ secrets.SLACK_CHANNEL }}
deploy:
name: Deploy `main` to PYPI
if: ${{ !github.event.release.prerelease && github.event.release.target_commitish == 'main' }}
runs-on: ubuntu-latest
steps:
- name: Set Release Version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Check Release Tag Format
run: |
re=[0-9]+\.[0-9]+\.[0-9]+
if ! [[ $RELEASE_VERSION =~ $re ]]; then
echo 'Tag does not match expected regex pattern for beta releases (v[0-9]+.[0-9]+.[0-9]+b[0-9]+)'
echo $RELEASE_VERSION
echo 'Please update your tag to match the expected regex pattern'
exit 1
fi
- name: Checkout
uses: actions/checkout@v4
- name: Install Packages
run: |-
pip install -r requirements.txt
pip install -r test-requirements.txt
- name: Test
run: |-
pytest -v
- name: Deploy to PYPI
run: |
pip install twine
pip install wheel
python setup.py sdist bdist_wheel
twine upload dist/* -u __token__ -p $PYPI_API_KEY
env:
PYPI_API_KEY: ${{ secrets.PYPI_API_KEY }}
- uses: Bandwidth/[email protected]
if: always()
with:
job-status: ${{ job.status }}
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel: ${{ secrets.SLACK_CHANNEL }}