Bump version: 0.7.0 → 0.8.0 #156
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: bump version | |
on: | |
push: | |
branches: | |
- dev | |
jobs: | |
bump-version: | |
runs-on: ubuntu-latest | |
if: "startsWith(github.event.head_commit.message, '[') && github.event.head_commit.author.name != 'upesy-bot'" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.API_GITHUB_TOKEN }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
cache: "pip" | |
- name: Setup Git | |
run: | | |
git config user.name "upesy-bot" | |
git config user.email '[email protected]' | |
git remote set-url origin https://x-access-token:${{ secrets.API_GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY | |
git checkout "${GITHUB_REF:11}" | |
- name: Setup env variables | |
run: | | |
echo "SKIPBUMP=FALSE" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install bump2version | |
# If a commit starts with [MAJOR] a new major verion upgrade will be triggered. | |
- name: Bump Major Version | |
env: | |
COMMIT_MSG: ${{ github.event.head_commit.message }} | |
run: | | |
bump2version major | |
echo "SKIPBUMP=TRUE" >> $GITHUB_ENV | |
if: "startsWith(github.event.head_commit.message, '[MAJOR]')" | |
# If a commit starts with [FEATURE] a new minor verion upgrade will be triggered. | |
- name: Bump Minor Version | |
env: | |
COMMIT_MSG: ${{ github.event.head_commit.message }} | |
run: | | |
bump2version minor | |
echo "SKIPBUMP=TRUE" >> $GITHUB_ENV | |
if: "startsWith(github.event.head_commit.message, '[FEATURE]')" | |
# If a commit starts with [FIX] a new patch verion upgrade will be triggered. | |
- name: Bump Patch Version | |
env: | |
COMMIT_MSG: ${{ github.event.head_commit.message }} | |
run: | | |
bump2version patch | |
if: "startsWith(github.event.head_commit.message, '[FIX]')" | |
- name: Commit version change to master | |
run: | | |
git push --follow-tags |