Skip to content

[SKIP] version bump 0.1.31 -> 0.1.32 #266

[SKIP] version bump 0.1.31 -> 0.1.32

[SKIP] version bump 0.1.31 -> 0.1.32 #266

name: Build and version bump
on:
push:
branches:
- main
jobs:
bump-version:
runs-on: ubuntu-latest
if: "!startsWith(github.event.head_commit.message, '[SKIP]')"
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.AC_GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Setup Git
run: |
git config user.name "joaomcteixeira"
git config user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ secrets.AC_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 build bump2version twine
# If a commit starts with [MAJOR] a new major verion upgrade will be
# triggered. Use with caution as Major upgrades denote backwards
# incompatibility. Yet I like it to be integrated in the CI
- 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]')"
- 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]')"
# Default action
- name: Bump Patch Version
env:
COMMIT_MSG: ${{ github.event.head_commit.message }}
run: |
bump2version patch
if: env.SKIPBUMP == 'FALSE'
- name: Commit version change to main
run: |
git push --follow-tags
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASS }}
run: |
python -m build
twine upload --verbose dist/*