bump: version 3.2.0 → 3.2.1 #110
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
# Run tests then upload to Pypi on version bumps. | |
# Run tests on each push. | |
# Try to bump version | |
# If version is bumped, upload to pypi or test.pypi depending on branch name. | |
name: pypi project | |
on: | |
push: | |
branches: [dev, master] | |
pull_request: | |
branches: [master] | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
# if: startsWith(github.event.head_commit.message, 'bump:') == false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
python -m pip install pytest | |
python -m pip install commitizen | |
python -m pip install . | |
- name: Test with pytest | |
run: | | |
pytest | |
# # If the tests pass, try to bump the version number. If no bump is warranted, | |
# # pass silently. | |
# bump_version: | |
# runs-on: ubuntu-latest | |
# name: "Bump version and create changelog with commitizen" | |
# continue-on-error: false | |
# needs: [tests] | |
# if: github.ref == 'refs/heads/dev' | |
# steps: | |
# - name: Check out | |
# uses: actions/checkout@v4 | |
# with: | |
# fetch-depth: 0 | |
# token: "${{ secrets.COMMITIZEN_BUMP }}" | |
# - id: cz | |
# name: Create bump and changelog | |
# uses: commitizen-tools/commitizen-action@master | |
# with: | |
# github_token: ${{ secrets.COMMITIZEN_BUMP }} | |
# - name: Print Version | |
# run: echo "Bumped to version ${{ steps.cz.outputs.version }}" | |
# Deploy on test.pypi when branch is dev and commit message starts with 'bump' | |
deploy-on-testpypi: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
needs: [tests] | |
if: github.ref_name == 'dev' && startsWith(github.event.head_commit.message, 'bump:') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
- name: Build package | |
run: python -m build | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | |
with: | |
repository_url: https://test.pypi.org/legacy/ | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
# Deploy on pypi when branch is master and commit message starts with 'bump' | |
deploy-on-pypi: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
needs: [tests] | |
if: github.ref_name == 'master' && startsWith(github.event.head_commit.message, 'bump:') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
- name: Build package | |
run: python -m build | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |