Skip to content

Commit ed589d7

Browse files
committed
Very painful process
1 parent 0b8eb07 commit ed589d7

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

.github/workflows/publish-testpypi.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,36 @@ jobs:
1111
uses: ./.github/workflows/quality.yml
1212

1313
publish:
14+
# This job publishes to TestPyPI when a GitHub release is created with a tag starting with 'v' on the release branch.
15+
#
16+
# Requirements:
17+
# - Repository admin must create a release with a tag starting with 'v' (e.g., v1.2.3)
18+
# - The tag must be created on the 'release' branch
19+
# - The release branch is protected by rulesets requiring all changes go through PR review
20+
#
21+
# Security notes:
22+
# - The tag and branch checks in this job are soft checks (can be bypassed by modifying workflow)
23+
# - Real security enforcement comes from the 'pypi' environment which requires manual approval by org admin
24+
# - This provides a final gate before any code is published to TestPyPI
1425
needs: test
1526
runs-on: ubuntu-latest
1627
if: startsWith(github.ref, 'refs/tags/v')
1728
environment:
1829
name: pypi
19-
steps:
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 0 # Need full history to check branch ancestry
35+
36+
- name: Check if tag is on release branch
37+
run: |
38+
if ! git branch -r --contains ${{ github.ref }} | grep -q 'origin/release'; then
39+
echo "Error: Tag is not on release branch"
40+
exit 1
41+
fi
42+
echo "Tag verified to be on release branch"
43+
2044
- name: Download distributions
2145
uses: actions/download-artifact@v4
2246
with:

0 commit comments

Comments
 (0)