v0.3.1-rc1 — TestPyPI publish test #2
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] | |
| permissions: | |
| id-token: write # Required for trusted publishing | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Install build tools | |
| run: pip install build | |
| - name: Build sdist and wheel | |
| run: python -m build | |
| - name: Verify package | |
| run: | | |
| pip install twine | |
| twine check dist/* | |
| - uses: actions/upload-artifact@v5 | |
| with: | |
| name: dist | |
| path: dist/ | |
| # TestPyPI: triggered by pre-release tags (e.g., v0.3.0-rc1, v0.3.0-beta) | |
| # or releases created from test/development branches | |
| publish-testpypi: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: github.event.release.prerelease == true | |
| environment: | |
| name: testpypi | |
| url: https://test.pypi.org/p/forgelm | |
| steps: | |
| - uses: actions/download-artifact@v5 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Publish to TestPyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| # PyPI: triggered by stable releases (non-prerelease) from main | |
| publish-pypi: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: github.event.release.prerelease == false | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/forgelm | |
| steps: | |
| - uses: actions/download-artifact@v5 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |