1- name : Build and release
1+ name : test and bump
22
33on :
44 push :
55 branches : [master]
66 pull_request :
77 branches : [master]
8- release :
9- types : [published]
108
119jobs :
12- Test :
10+ test :
1311 runs-on : ubuntu-latest
14- strategy :
15- matrix :
16- python-version : [2.7, 3.6]
1712 steps :
1813 - name : Checkout
19- uses : actions/checkout@v2
14+ uses : actions/checkout@v4
2015 with :
21- python-version : ${{ matrix.python-version }}
16+ fetch-depth : 0
2217
23- - name : Set up Python ${{ matrix.python-version }}
24- uses : actions/setup-python@v2
18+ - name : Set up Python
19+ uses : actions/setup-python@v5
2520 with :
26- python-version : ${{ matrix.python-version }}
21+ python-version : ' 3.11 '
2722
2823 - name : Install python dependencies
2924 run : |
@@ -39,14 +34,48 @@ jobs:
3934 run : |
4035 ./run-tests.sh
4136
42- - name : Build package
43- if : ${{ success() && github.event_name == 'release' && matrix.python-version == '3.6' }}
37+ bump :
38+ outputs :
39+ new_sha : ${{ steps.sha.outputs.SHA }}
40+ needs : test
41+ if : ${{ github.event_name == 'push' }}
42+ runs-on : ubuntu-latest
43+ steps :
44+ - name : Check out the repository
45+ uses : actions/checkout@v4
46+
47+ - name : Set up Python
48+ uses : actions/setup-python@v5
49+ with :
50+ python-version : ' 3.11'
51+
52+ - name : Install bump2version
53+ shell : bash
54+ run : |
55+ python -m pip install --upgrade pip
56+ pip install bump2version
57+
58+ - name : Configure git
59+ shell : bash
60+ run : |
61+ git config user.name github-actions
62+ git config user.email [email protected] 63+
64+ - name : Bump version
65+ shell : bash
4466 run : |
45- python setup.py sdist bdist_wheel
67+ bump2version patch --tag --verbose
4668
47- - name : Publish package
48- if : ${{ success() && github.event_name == 'release' && matrix.python-version == '3.6' }}
49- 69+ - name : Push changes
70+ uses : ad-m/github-push-action@master
5071 with :
51- user : __token__
52- password : ${{ secrets.pypi_token }}
72+ github_token : ${{ secrets.GITHUB_TOKEN }}
73+ branch : ${{ github.ref }}
74+ tags : true
75+
76+ - name : get sha
77+ id : sha
78+ run : |
79+ sha_new=$(git rev-parse HEAD)
80+ echo $sha_new
81+ echo "::set-output name=SHA::$sha_new"
0 commit comments