Skip to content

SOTODLIB PyPI Publish #12

SOTODLIB PyPI Publish

SOTODLIB PyPI Publish #12

Workflow file for this run

name: SOTODLIB PyPI Publish
on:
release:
types: [published]
workflow_dispatch:
# SOTODLIB Monthly Release uses GITHUB_TOKEN. Any repository changes it makes do
# not trigger a new workflow run.
# This is a "workflow" based trigger. It checks the events and when the monthly
# release is run successfully, it gets triggered.
workflow_run:
workflows: ["SOTODLIB Monthly Release"]
types:
- completed
jobs:
pypi-publish:
# This if statement checks if the event is not a workflow_run or if the workflow_run was successful
if: |
github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: read # Required to checkout the repository
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0 # Fetch full history for tags
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Verify we're on the correct tag
run: |
echo "Current tag: $(git describe --tags --exact-match)"
git checkout "refs/tags/$(git describe --tags --exact-match)"
- name: Build
run: |
python -m pip install --upgrade pip setuptools wheel build
python -m build --wheel --sdist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1