release: 0.3.0 #4
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: Release | |
| # Publishes to PyPI when a version tag is pushed (e.g. `git tag v0.4.0 && git push --tags`). | |
| # Uses PyPI Trusted Publishing (OIDC) - no API token is stored anywhere. | |
| # | |
| # ONE-TIME SETUP on pypi.org (Account -> Publishing -> Add a pending publisher): | |
| # PyPI project name: writing-agent | |
| # Owner: vikast908 | |
| # Repository: WritingAgent | |
| # Workflow name: release.yml | |
| # Environment name: pypi | |
| # Then create a `pypi` environment in the repo settings (optional protection rules). | |
| on: | |
| push: | |
| tags: ["v*"] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Build sdist + wheel | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Build | |
| run: | | |
| python -m pip install --upgrade pip build | |
| python -m build | |
| - name: Check metadata | |
| run: | | |
| python -m pip install twine | |
| twine check dist/* | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: dist | |
| path: dist/ | |
| publish: | |
| name: Publish to PyPI | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: pypi | |
| permissions: | |
| id-token: write # OIDC trusted publishing | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - uses: pypa/gh-action-pypi-publish@release/v1 |