v0.3.0 #3
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] | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: 'Environment to publish to' | |
| required: true | |
| default: 'test' | |
| type: choice | |
| options: | |
| - test | |
| - Production | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # Required for OIDC | |
| contents: read | |
| environment: | |
| name: ${{ github.event.inputs.environment || 'Production' }} | |
| url: https://pypi.org/p/syrin | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install build | |
| run: pip install build | |
| - name: Build package | |
| run: python -m build | |
| - name: Install twine | |
| run: pip install twine | |
| - name: Check package | |
| run: twine check dist/* | |
| - name: Publish to PyPI (Trusted Publisher) | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| if: github.event.inputs.environment == 'Production' || github.event_name == 'release' | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.PYPI_API_TOKEN }} | |
| - name: Publish to Test PyPI (Trusted Publisher) | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| if: github.event.inputs.environment == 'test' |