-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (55 loc) · 1.79 KB
/
main.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
name: Deploy to PyPi
on:
push:
branches:
- main
permissions:
contents: write
concurrency: "main"
jobs:
test:
uses: ./.github/workflows/test.yml
deploy:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build bump2version
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# Wait until successful build to configure git and bump versions
- name: Configure Git
run: |
git config user.name "Bump Version"
git config user.email "[email protected]"
- name: Bump Major Version
run: |
bump2version major
echo "SKIPBUMP=TRUE" >> $GITHUB_ENV
if: "startsWith(github.event.head_commit.message, '[MAJOR]')"
- name: Bump Minor Version
run: |
bump2version minor
echo "SKIPBUMP=TRUE" >> $GITHUB_ENV
if: "startsWith(github.event.head_commit.message, '[FEATURE]')"
# Default action
- name: Bump Patch Version
run: |
bump2version patch
if: env.SKIPBUMP != 'TRUE'
- name: Push commit
run: git push https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY.git --follow-tags
- name: Build a binary wheel and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/
# Wait until successful build to configure git and bump versions
- name: Deploy to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}