From c43f08c599e49953feaab7c5a54205f7136deab3 Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Thu, 21 May 2026 18:13:15 +0100 Subject: [PATCH 1/2] Split workflow to reduce the available permissions during the build step --- .github/workflows/publish-to-pypi.yaml | 48 ++++++++++++++++++-------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/.github/workflows/publish-to-pypi.yaml b/.github/workflows/publish-to-pypi.yaml index dbd9a00c..5ae3e100 100644 --- a/.github/workflows/publish-to-pypi.yaml +++ b/.github/workflows/publish-to-pypi.yaml @@ -6,22 +6,15 @@ on: - v[0-9]+.[0-9]+.[0-9]+ jobs: - publish: - name: Build + build: + name: Build distribution runs-on: ubuntu-latest - # This environment is required as an input to pypa/gh-action-pypi-publish - environment: - name: pypi - url: https://pypi.org/p/seclab-taskflow-agent - env: GITHUB_REPO: ${{ github.repository }} permissions: - contents: write - id-token: write # For trusted publishing - attestations: write # For artifact attestation + contents: read steps: - name: Checkout repository @@ -40,17 +33,42 @@ jobs: - name: Build the wheel run: python3 -m hatch build - - name: Attest build provenance - uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2.0 - with: - subject-path: ./dist/* - - name: Upload artifacts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 with: name: python-package-distributions path: ./dist/ + publish: + name: Publish to PyPI + needs: build + runs-on: ubuntu-latest + + # This environment is required as an input to pypa/gh-action-pypi-publish + environment: + name: pypi + url: https://pypi.org/p/seclab-taskflow-agent + + env: + GITHUB_REPO: ${{ github.repository }} + + permissions: + contents: write + id-token: write # For trusted publishing + attestations: write # For artifact attestation + + steps: + - name: Download distribution artifacts + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: python-package-distributions + path: ./dist/ + + - name: Attest build provenance + uses: actions/attest@v4.1.0 # immutable release + with: + subject-path: ./dist/* + - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 with: From ff6fe81afde982df73812a365377198c841bf36a Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Mon, 1 Jun 2026 12:50:32 +0100 Subject: [PATCH 2/2] Update .github/workflows/publish-to-pypi.yaml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jaroslav Lobačevski --- .github/workflows/publish-to-pypi.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/publish-to-pypi.yaml b/.github/workflows/publish-to-pypi.yaml index 5ae3e100..a58de345 100644 --- a/.github/workflows/publish-to-pypi.yaml +++ b/.github/workflows/publish-to-pypi.yaml @@ -10,8 +10,6 @@ jobs: name: Build distribution runs-on: ubuntu-latest - env: - GITHUB_REPO: ${{ github.repository }} permissions: contents: read