|
| 1 | +name: Publish Python 🐍 distribution 📦 to JFrog and TestJFrog |
| 2 | + |
| 3 | +on: push |
| 4 | + |
| 5 | +jobs: |
| 6 | + build: |
| 7 | + name: Build distribution 📦 |
| 8 | + runs-on: ubuntu-latest |
| 9 | + |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v4 |
| 12 | + - name: Install uv |
| 13 | + uses: astral-sh/setup-uv@v6 |
| 14 | + with: |
| 15 | + # Install a specific version of uv. |
| 16 | + version: "0.5.5" |
| 17 | + - name: Install the project |
| 18 | + run: uv sync --all-extras --dev --index="https://${{ secrets.JFROG_USER}}:${{ secrets.JFROG_TOKEN }}@quera.jfrog.io/artifactory/api/pypi/kirin/simple/" --index="https://${{ secrets.JFROG_USER}}:${{ secrets.JFROG_TOKEN }}@quera.jfrog.io/artifactory/api/pypi/quera-pypi-algo/simple/" |
| 19 | + - name: Build distribution 📦 |
| 20 | + run: uv build |
| 21 | + - name: Store the distribution packages |
| 22 | + uses: actions/upload-artifact@v4 |
| 23 | + with: |
| 24 | + name: python-package-distributions |
| 25 | + path: dist/ |
| 26 | + |
| 27 | + publish-to-jfrog: |
| 28 | + name: >- |
| 29 | + Publish Python 🐍 distribution 📦 to Jfrog |
| 30 | + if: startsWith(github.ref, 'refs/tags/') # only publish on tag pushes |
| 31 | + needs: |
| 32 | + - build |
| 33 | + runs-on: ubuntu-latest |
| 34 | + |
| 35 | + steps: |
| 36 | + - name: Download all the dists |
| 37 | + uses: actions/download-artifact@v4 |
| 38 | + with: |
| 39 | + name: python-package-distributions |
| 40 | + path: dist/ |
| 41 | + - name: Install uv |
| 42 | + uses: astral-sh/setup-uv@v6 |
| 43 | + with: |
| 44 | + # Install a specific version of uv. |
| 45 | + version: "0.5.5" |
| 46 | + - name: Publish distribution 📦 to JFrog |
| 47 | + run: uv publish --publish-url ${{secrets.QUERA_ALGO_PYPI_REPOSITORY_URL}} --username ${{secrets.JFROG_KIRIN_USERNAME}} --password ${{secrets.JFROG_KIRIN_PASSWORD}} |
| 48 | + |
| 49 | + |
| 50 | + github-release: |
| 51 | + name: >- |
| 52 | + Sign the Python 🐍 distribution 📦 with Sigstore |
| 53 | + and upload them to GitHub Release |
| 54 | + needs: |
| 55 | + - publish-to-jfrog |
| 56 | + runs-on: ubuntu-latest |
| 57 | + |
| 58 | + permissions: |
| 59 | + contents: write # IMPORTANT: mandatory for making GitHub Releases |
| 60 | + id-token: write # IMPORTANT: mandatory for sigstore |
| 61 | + |
| 62 | + steps: |
| 63 | + - name: Download all the dists |
| 64 | + uses: actions/download-artifact@v4 |
| 65 | + with: |
| 66 | + name: python-package-distributions |
| 67 | + path: dist/ |
| 68 | + - name: Sign the dists with Sigstore |
| 69 | + |
| 70 | + with: |
| 71 | + inputs: >- |
| 72 | + ./dist/*.tar.gz |
| 73 | + ./dist/*.whl |
| 74 | + - name: Create GitHub Release |
| 75 | + env: |
| 76 | + GITHUB_TOKEN: ${{ github.token }} |
| 77 | + run: >- |
| 78 | + gh release create |
| 79 | + '${{ github.ref_name }}' |
| 80 | + --repo '${{ github.repository }}' |
| 81 | + --notes "" |
| 82 | + - name: Upload artifact signatures to GitHub Release |
| 83 | + env: |
| 84 | + GITHUB_TOKEN: ${{ github.token }} |
| 85 | + # Upload to GitHub Release using the `gh` CLI. |
| 86 | + # `dist/` contains the built packages, and the |
| 87 | + # sigstore-produced signatures and certificates. |
| 88 | + run: >- |
| 89 | + gh release upload |
| 90 | + '${{ github.ref_name }}' dist/** |
| 91 | + --repo '${{ github.repository }}' |
0 commit comments