v0.3.8 #13
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: | |
| release: | |
| types: [published] | |
| # Least privilege by default: jobs get no GITHUB_TOKEN scopes unless they | |
| # opt in below. | |
| permissions: {} | |
| jobs: | |
| build: | |
| name: Build distribution | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| # hatch-vcs derives the version from git tags, so we need full history. | |
| fetch-depth: 0 | |
| - name: Install uv | |
| # uv provisions its own Python (honoring requires-python), so no | |
| # separate actions/setup-python step is needed. | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Build package | |
| # hatch-vcs reads the version straight from the release tag. | |
| run: | | |
| uv build | |
| echo "Built distributions:" | |
| ls -l dist/ | |
| - name: Store the distribution packages | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| - name: Upload assets to GitHub Release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release upload ${{ github.ref_name }} dist/* --clobber | |
| publish-to-pypi: | |
| name: Publish to PyPI | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/codeplain | |
| permissions: | |
| # Mint a short-lived OIDC token so PyPI Trusted Publishing can | |
| # authenticate this run — no long-lived API token needed. | |
| id-token: write | |
| steps: | |
| - name: Download distribution packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |