1- name : Bump Version and Tag for Release
1+ name : Conditional Bump Version
22
33on :
4- workflow_dispatch :
5- inputs :
6- bumpversion :
7- description : " Bumpversion"
8- required : true
9- default : " patch"
10- options :
11- - " patch"
12- - " minor"
13- - " major"
14- tag :
15- description : " Tag"
16- required : true
17- default : true
18- options :
19- - " true"
20- - " false"
4+ push :
5+ branches :
6+ - master
7+ paths-ignore :
8+ - .*
9+ - .github/*/*.md
10+ - .github/*/*.yml
11+ - AUTHORS.rst
12+ - CHANGES.rst
13+ - Dockerfile
14+ - Makefile
15+ - docker-compose.yml
16+ - docs/*/*.ipynb
17+ - docs/*/*.py
18+ - docs/*/*.rst
19+ - docs/Makefile
20+ - docs/_static/*
21+ - environment-docs.yml
22+ - finch/__version__.py
23+ - requirements*.txt
24+ - setup.cfg
25+ - setup.py
26+
27+ permissions :
28+ contents : read
29+
2130jobs :
2231 bump_patch_version :
2332 name : Bumpversion
2433 runs-on : ubuntu-latest
34+ permissions :
35+ actions : read
36+ contents : write
2537 steps :
38+ - name : Harden Runner
39+ uses : step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
40+ with :
41+ disable-sudo : true
42+ egress-policy : block
43+ allowed-endpoints : >
44+ files.pythonhosted.org:443
45+ github.com:443
46+ pypi.org:443
2647 - uses : actions/checkout@v4
2748 with :
2849 persist-credentials : false
@@ -37,24 +58,33 @@ jobs:
3758 run : |
3859 CURRENT_VERSION="$(grep -E '__version__' finch/__version__.py | cut -d ' ' -f3)"
3960 echo "current_version=${CURRENT_VERSION}"
61+ echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
4062 - name : Bump Version
4163 if : ${{ github.event.inputs.tag == 'false' }}
4264 run : |
4365 pip install bump-my-version
4466 echo "running `bump-my-version bump --no-tag ${{ github.event.inputs.bumpversion }}`"
4567 NEW_VERSION="$(grep -E '__version__' finch/__version__.py | cut -d ' ' -f3)"
4668 echo "new_version=${NEW_VERSION}"
47- - name : Bump Version with Tagging
48- if : ${{ github.event.inputs.tag == 'true' }}
69+ - name : Install bump-my-version
4970 run : |
50- pip install bump-my-version
51- echo "running `bump-my-version bump ${{ github.event.inputs.bumpversion }}`"
52- NEW_VERSION="$(grep -E '__version__' finch/__version__.py | cut -d ' ' -f3)"
71+ python -m pip install bump-my-version>=0.18.3
72+ - name : Conditional Bump
73+ id : bump
74+ run : |
75+ if [[ ${{ env.CURRENT_VERSION }} =~ -dev(\.\d+)? ]]; then
76+ echo "Development version (ends in 'dev(\.\d+)?'), bumping 'build' version"
77+ bump-my-version bump build
78+ else
79+ echo "Version is stable, bumping 'patch' version"
80+ bump-my-version bump patch
81+ fi
82+ NEW_VERSION="$(grep -E '__version__' finch/__version__.py | cut -d ' ' -f3)"
5383 echo "new_version=${NEW_VERSION}"
84+ echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
5485 - name : Push Changes
5586 uses : ad-m/github-push-action@master
5687 with :
5788 force : false
5889 github_token : ${{ secrets.BUMPVERSION_TOKEN }}
5990 branch : ${{ github.ref }}
60- tags : true
0 commit comments