v0.90.2-alpha2 #14
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
# This workflow will upload a Python Package using Twine when a release is created | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: Update Version and Upload Package | |
on: | |
release: | |
types: [published] | |
permissions: | |
contents: read | |
jobs: | |
update-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install bump2version build twine | |
- name: Extract version from tag | |
id: extract_version | |
run: | | |
# Extract the version from the Git tag | |
tag=$(echo ${GITHUB_REF} | sed 's/refs\/tags\///') | |
echo "VERSION=$tag" >> $GITHUB_ENV | |
- name: Update version in pyproject.toml | |
run: | | |
# Use bump2version to update version in pyproject.toml | |
bump2version --new-version $VERSION patch # or minor/major based on your needs | |
git commit -am "Update version to $VERSION" | |
git push | |
git push --tags | |
- 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 }} |