|
1 | 1 | name: Publish to TestPyPI |
2 | 2 |
|
3 | | -on: |
4 | | - workflow_dispatch: |
5 | | - inputs: |
6 | | - version: |
7 | | - description: 'Version name for release. Must start with: "test-release-".' |
8 | | - required: true |
9 | | - |
| 3 | +on: workflow_dispatch |
10 | 4 |
|
11 | 5 | jobs: |
12 | 6 | publish: |
13 | | - name: Publish wheel to TestPyPI |
| 7 | + name: Build |
| 8 | + runs-on: ubuntu-latest |
| 9 | + |
| 10 | + # This environment is required as an input to pypa/gh-action-pypi-publish |
| 11 | + environment: |
| 12 | + name: testpypi |
| 13 | + url: https://test.pypi.org/p/seclab-taskflow-agent2 |
| 14 | + |
| 15 | + env: |
| 16 | + GITHUB_REPO: ${{ github.repository }} |
| 17 | + |
14 | 18 | permissions: |
15 | 19 | contents: write |
16 | 20 | id-token: write # For trusted publishing |
17 | | - if: startsWith(inputs.version, 'test-release-') |
18 | | - uses: ./.github/workflows/publish-reusable.yml |
19 | | - with: |
20 | | - version: ${{ inputs.version }} |
21 | | - release_notes: ${{ github.head_ref }} |
22 | | - repository_url: https://test.pypi.org/legacy/ |
23 | | - environment_name: testpypi |
24 | | - environment_url: https://test.pypi.org/p/seclab-taskflow-agent2 |
25 | | - secrets: |
26 | | - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Generate unique name for the test release |
| 24 | + id: create_release_name |
| 25 | + run: echo "RELEASE_NAME=test-release-`date -Is --utc`" >> $GITHUB_OUTPUT |
| 26 | + |
| 27 | + - name: Checkout repository |
| 28 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 29 | + with: |
| 30 | + persist-credentials: false |
| 31 | + |
| 32 | + - name: Set up Python |
| 33 | + uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 |
| 34 | + with: |
| 35 | + python-version: "3.13" |
| 36 | + |
| 37 | + - name: Install Hatch |
| 38 | + run: pip install --upgrade hatch |
| 39 | + |
| 40 | + - name: Build the wheel |
| 41 | + run: python3 -m hatch build |
| 42 | + |
| 43 | + - name: Upload artifacts |
| 44 | + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 |
| 45 | + with: |
| 46 | + name: python-package-distributions |
| 47 | + path: dist/ |
| 48 | + |
| 49 | + - name: Publish to TestPyPI |
| 50 | + uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 |
| 51 | + with: |
| 52 | + repository-url: https://test.pypi.org/legacy/ |
| 53 | + |
| 54 | + - name: Sign with sigstore |
| 55 | + uses: sigstore/gh-action-sigstore-python@f832326173235dcb00dd5d92cd3f353de3188e6c # v3.1.0 |
| 56 | + with: |
| 57 | + inputs: >- |
| 58 | + ./dist/*.tar.gz |
| 59 | + ./dist/*.whl |
| 60 | +
|
| 61 | + - name: Create GitHub Release |
| 62 | + env: |
| 63 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 64 | + RELEASE_NAME: ${{ steps.create_release_name.outputs.RELEASE_NAME }} |
| 65 | + NOTES: "Test Release" |
| 66 | + run: gh release create $RELEASE_NAME --repo $GITHUB_REPO --notes $NOTES |
| 67 | + |
| 68 | + - name: Upload GitHub Release |
| 69 | + env: |
| 70 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 71 | + RELEASE_NAME: ${{ steps.create_release_name.outputs.RELEASE_NAME }} |
| 72 | + run: gh release upload $RELEASE_NAME dist/** --repo $GITHUB_REPO |
0 commit comments