Skip to content

Bump version and publish to PyPI #8

Bump version and publish to PyPI

Bump version and publish to PyPI #8

# 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}). Current version: 0.0.9"
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 }}
- 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/
- name: Push changes
run: |
git push origin feature/release_pipeline_2
git push origin --tags