Skip to content

Update github workflow to automatically publish release on new version #2

Update github workflow to automatically publish release on new version

Update github workflow to automatically publish release on new version #2

Workflow file for this run

name: Release and Upload to PyPI
on:
push:
tags:
- 'v*' # triggers on tags like v0.1.0, v1.2.3, etc.
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
generate_release_notes: true
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build
- name: Upload release artifacts
uses: softprops/action-gh-release@v1
with:
files: |
dist/*.tar.gz
dist/*.whl
- name: Upload to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload dist/*