Skip to content

Merge pull request #20 from sharktide/1.2.0 #15

Merge pull request #20 from sharktide/1.2.0

Merge pull request #20 from sharktide/1.2.0 #15

Workflow file for this run

name: Publish Python Package
on:
push:
branches:
- main # Trigger the workflow only on pushes to the 'main' branch
paths:
- pyproject.toml
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest # Use an Ubuntu runner for compatibility
environment:
name: pypi # Optional: Define a deployment environment
permissions:
id-token: write # Grant permission to request an OIDC token
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install twine setuptools wheel build toml
- name: Get version from pyproject.toml
id: get_version
run: |
VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")
echo "VERSION=$VERSION"
echo "release_version=$VERSION" >> $GITHUB_ENV
- name: Build the package
run: |
python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Create a GitHub release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: "v${{ env.release_version }}"
name: "${{ env.release_version }}" # Use version from pyproject.toml as release title
prerelease: false # Mark as a pre-release (beta)
files: |
dist/*.whl
dist/*.tar.gz
body: |
View the [changelog](https://restructuredpython.readthedocs.io/en/latest/changelog.html) for information about this release.
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }} # GitHub token for authentication