publish-packages #1
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-packages-and-docs | |
| on: | |
| release: | |
| types: ["published"] | |
| workflow_dispatch: | |
| inputs: | |
| is_test: | |
| description: 'Publish to test repositories instead of production' | |
| required: true | |
| type: boolean | |
| default: false | |
| jobs: | |
| packages: | |
| name: "Build and publish release" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Build package | |
| run: make build | |
| - name: Publish packages to PyPI Test | |
| if: ${{ github.event.inputs.run_deploy == 'true' }} | |
| run: | | |
| uv publish --index testpypi --token ${{ secrets.TEST_PYPI_TOKEN }} | |
| - name: Publish release packages to PyPI | |
| if: ${{ github.event.inputs.run_deploy == 'false' }} | |
| run: uv publish --token ${{ secrets.PYPI_TOKEN }} | |
| docs: | |
| needs: packages | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Generate docs | |
| run: make generate-docs | |
| - name: Publish release docs to test location | |
| if: ${{ github.event.inputs.run_deploy == 'true' }} | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs | |
| # this puts the docs for this tag under gh-pages:/rc/<tag>/ | |
| destination_dir: rc/${{ github.event.release.tag_name }} | |
| - name: Publish release docs to production location | |
| if: ${{ github.event.inputs.run_deploy == 'false' }} | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs |