release #15
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 | |
| on: | |
| push: | |
| tags: | |
| - "*" | |
| workflow_dispatch: | |
| inputs: | |
| pypi-repository: | |
| type: choice | |
| description: Whether to upload to a test repository or production repository | |
| required: true | |
| default: testpypi | |
| options: | |
| - pypi | |
| - testpypi | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| hashes: ${{ steps.build.outputs.hashes }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup environment | |
| uses: ./.github/actions/setup-env | |
| with: | |
| environment: "build" | |
| - name: Build dists | |
| id: build | |
| uses: ./.github/actions/build | |
| provenance: | |
| name: Provenance | |
| needs: [build] | |
| permissions: | |
| actions: read | |
| contents: write | |
| id-token: write # Needed to access the workflow's OIDC identity. | |
| uses: "slsa-framework/slsa-github-generator/.github/workflows/[email protected]" | |
| with: | |
| base64-subjects: "${{ needs.build.outputs.hashes }}" | |
| upload-assets: true | |
| publish-pypi: | |
| name: "Publish to PyPI" | |
| if: | |
| ( github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') ) || ( | |
| github.event_name == 'workflow_dispatch' && github.event.inputs.pypi-repository == | |
| 'pypi' ) | |
| needs: ["build", "provenance"] | |
| permissions: | |
| contents: write | |
| id-token: write | |
| runs-on: "ubuntu-latest" | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/ragna | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: "Download dists" | |
| uses: "actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093" | |
| with: | |
| name: "dist" | |
| path: "dist/" | |
| - name: "Publish dists to PyPI" | |
| uses: "pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc" | |
| with: | |
| print-hash: true | |
| publish-testpypi: | |
| name: "Publish to TestPyPI" | |
| if: | |
| github.event_name == 'workflow_dispatch' && github.event.inputs.pypi-repository == | |
| 'testpypi' | |
| needs: ["build", "provenance"] | |
| permissions: | |
| contents: write | |
| id-token: write | |
| runs-on: "ubuntu-latest" | |
| environment: | |
| name: testpypi | |
| url: https://test.pypi.org/p/ragna | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: "Download dists" | |
| uses: "actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093" | |
| with: | |
| name: "dist" | |
| path: "dist/" | |
| - name: "Publish dists to TestPyPI" | |
| uses: "pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc" | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| print-hash: true |