release(0.2.2): bundle #61 (portable notebook paths) (#62) #6
Workflow file for this run
This file contains hidden or 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 to PyPI | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Verify tag matches pyproject.toml version | |
| # Catches the silent-fail mode where a `vX.Y.Z` tag is pushed | |
| # without bumping `pyproject.toml`: the build then produces a | |
| # wheel named after the old version, and PyPI rejects it as a | |
| # duplicate (existing upload). Fail loudly here, before the | |
| # build step, with the exact mismatch. | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| tag_version="${GITHUB_REF#refs/tags/v}" | |
| pyproject_version=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])") | |
| echo "tag version : $tag_version" | |
| echo "pyproject version : $pyproject_version" | |
| if [ "$tag_version" != "$pyproject_version" ]; then | |
| echo "::error::Tag v$tag_version does not match pyproject.toml version $pyproject_version." | |
| echo "::error::Bump pyproject.toml to $tag_version (and update CHANGELOG.md), commit, re-tag, then push." | |
| exit 1 | |
| fi | |
| echo "tag and pyproject version match." | |
| - name: Install build tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build | |
| - name: Build sdist + wheel | |
| run: python -m build | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| publish: | |
| name: Publish to PyPI | |
| runs-on: ubuntu-latest | |
| needs: build | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/omny | |
| permissions: | |
| id-token: write # required for PyPI trusted publishing (OIDC) | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| # Trusted publishing — no API token needed. Configure once at | |
| # https://pypi.org/manage/account/publishing/ pointing the | |
| # "omny" project at MaastrichtU-IDS/omny + this workflow | |
| # (publish.yml) + environment "pypi". |