|
| 1 | +name: Publish to PyPI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - v[0-9]+.[0-9]+.[0-9]+ |
| 7 | + |
| 8 | +jobs: |
| 9 | + publish: |
| 10 | + name: Build |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + # This environment is required as an input to pypa/gh-action-pypi-publish |
| 14 | + environment: |
| 15 | + name: pypi |
| 16 | + url: https://pypi.org/p/seclab-taskflow-agent |
| 17 | + |
| 18 | + env: |
| 19 | + GITHUB_REPO: ${{ github.repository }} |
| 20 | + |
| 21 | + permissions: |
| 22 | + contents: write |
| 23 | + id-token: write # For trusted publishing |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Checkout repository |
| 27 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 28 | + with: |
| 29 | + persist-credentials: false |
| 30 | + |
| 31 | + - name: Set up Python |
| 32 | + uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 |
| 33 | + with: |
| 34 | + python-version: "3.13" |
| 35 | + |
| 36 | + - name: Install Hatch |
| 37 | + run: pip install --upgrade hatch |
| 38 | + |
| 39 | + - name: Build the wheel |
| 40 | + run: python3 -m hatch build |
| 41 | + |
| 42 | + - name: Upload artifacts |
| 43 | + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 |
| 44 | + with: |
| 45 | + name: python-package-distributions |
| 46 | + path: dist/ |
| 47 | + |
| 48 | + - name: Publish to PyPI |
| 49 | + uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 |
| 50 | + with: |
| 51 | + verbose: true |
| 52 | + |
| 53 | + - name: Sign with sigstore |
| 54 | + uses: sigstore/gh-action-sigstore-python@f832326173235dcb00dd5d92cd3f353de3188e6c # v3.1.0 |
| 55 | + with: |
| 56 | + inputs: >- |
| 57 | + ./dist/*.tar.gz |
| 58 | + ./dist/*.whl |
| 59 | +
|
| 60 | + - name: Create GitHub Release |
| 61 | + env: |
| 62 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 63 | + RELEASE_NAME: ${{ github.ref_name }} |
| 64 | + run: gh release create $RELEASE_NAME --repo $GITHUB_REPO --generate-notes |
| 65 | + |
| 66 | + - name: Upload GitHub Release |
| 67 | + env: |
| 68 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 69 | + RELEASE_NAME: ${{ github.ref_name }} |
| 70 | + run: gh release upload $RELEASE_NAME dist/** --repo $GITHUB_REPO |
0 commit comments