Bump version and publish to PyPI #7
Workflow file for this run
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
# takes the most recent commit on main, bumps version based on | |
# semver_component input, pushes changes back to main, and publishes | |
# new version to PyPI | |
name: Bump version and publish to PyPI | |
on: | |
workflow_dispatch: | |
inputs: | |
semver_component: | |
description: "Semantic versioning component to bump (must be one of {major, minor, patch, dev})" | |
required: true | |
jobs: | |
publish: | |
name: Bump and publish | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build bumpver | |
# change branch to main for final version | |
- name: Bump version | |
run: | | |
git checkout feature/release_pipeline_2 | |
git config --global user.name 'Publish to PyPI' | |
git config --global user.email 'githubactions@users.noreply.github.com' | |
python publish_bumpver_handler.py ${{ inputs.semver_component }} | |
git push origin feature/release_pipeline_2 | |
git push origin --tags | |
- name: Build Package | |
run: | | |
python -m build | |
- name: Publish to Test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |