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
name: Publish Python Package | ||
on: | ||
push: # Trigger the workflow on every push to any branch | ||
branches: | ||
- '**' # This includes all branches | ||
# on: | ||
# push: | ||
# tags: | ||
# - 'v*.*.*' # Trigger on version tags | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write # Required for OIDC | ||
contents: read # Required for checking out the repository | ||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' # Use the correct Python version | ||
- name: Install build dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
- name: Build the package | ||
run: python -m build | ||
- name: Publish to PyPI using Trusted Publishing | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
# No need for credentials, PyPI will handle authentication via OIDC | ||
# Optionally, specify your PyPI repository if needed (testpypi or pypi) | ||
# repository-url: https://test.pypi.org/legacy/ |