Skip to content

Commit f6fd772

Browse files
Split workflow to reduce the available permissions during the build step.
1 parent 9c8bbd9 commit f6fd772

1 file changed

Lines changed: 34 additions & 16 deletions

File tree

.github/workflows/publish-to-testpypi.yaml

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,15 @@ name: Publish Pre-Release to TestPyPI
33
on: workflow_dispatch
44

55
jobs:
6-
publish:
7-
name: Build
6+
build:
7+
name: Build distribution
88
runs-on: ubuntu-latest
99

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-agent
14-
1510
env:
1611
GITHUB_REPO: ${{ github.repository }}
1712

1813
permissions:
19-
contents: write
20-
id-token: write # For trusted publishing
21-
attestations: write # For artifact attestation
14+
contents: read
2215

2316
steps:
2417
- name: Checkout repository
@@ -29,7 +22,7 @@ jobs:
2922
- name: Set up Python
3023
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
3124
with:
32-
python-version: "3.13"
25+
python-version: "3.14"
3326

3427
- name: Install Hatch
3528
run: pip install --upgrade hatch
@@ -52,17 +45,42 @@ jobs:
5245
- name: Build the wheel
5346
run: python3 -m hatch build
5447

55-
- name: Attest build provenance
56-
uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2.0
57-
with:
58-
subject-path: ./dist/*
59-
6048
- name: Upload artifacts
6149
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
6250
with:
6351
name: python-package-distributions
6452
path: ./dist/
6553

54+
publish:
55+
name: Publish to TestPyPI
56+
needs: build
57+
runs-on: ubuntu-latest
58+
59+
# This environment is required as an input to pypa/gh-action-pypi-publish
60+
environment:
61+
name: testpypi
62+
url: https://test.pypi.org/p/seclab-taskflow-agent
63+
64+
env:
65+
GITHUB_REPO: ${{ github.repository }}
66+
67+
permissions:
68+
contents: write
69+
id-token: write # For trusted publishing
70+
attestations: write # For artifact attestation
71+
72+
steps:
73+
- name: Download distribution artifacts
74+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
75+
with:
76+
name: python-package-distributions
77+
path: ./dist/
78+
79+
- name: Attest build provenance
80+
uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2.0
81+
with:
82+
subject-path: ./dist/*
83+
6684
- name: Publish to TestPyPI
6785
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
6886
with:

0 commit comments

Comments
 (0)