continuous-deployment #5
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: continuous-deployment | |
| # deploy on creating a release tag vX.Y.Z | |
| # will only be published to PyPi if the tests pass | |
| on: | |
| release: | |
| types: [created] | |
| workflow_dispatch: | |
| jobs: | |
| ci: | |
| permissions: | |
| contents: read | |
| uses: ./.github/workflows/ci.yml | |
| publish: | |
| name: Publish to PyPi | |
| permissions: | |
| contents: read | |
| needs: [ci] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.9 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.9 | |
| - name: Install flit | |
| run: | | |
| pip install flit~=3.4 | |
| - name: Build and Publish to TestPyPi | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| flit publish | |
| env: | |
| FLIT_USERNAME: __token__ | |
| FLIT_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
| FLIT_INDEX_URL: https://test.pypi.org/legacy/ | |
| - name: Build and Publish to PyPi | |
| if: github.event_name == 'release' | |
| run: | | |
| flit publish | |
| env: | |
| FLIT_USERNAME: __token__ | |
| FLIT_PASSWORD: ${{ secrets.PYPI_TOKEN }} |