Skip to content

Commit 77c8706

Browse files
committed
chore(ci): Upload attested package to (test)PyPI
1 parent 36468b3 commit 77c8706

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/test.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
branches:
1010
- master
1111
- maint/*
12+
tags:
13+
- '*'
1214
pull_request: {}
1315
schedule:
1416
# 8am EST / 9am EDT Mondays
@@ -112,3 +114,44 @@ jobs:
112114
with:
113115
files: cov.xml
114116
token: ${{ secrets.CODECOV_TOKEN }}
117+
118+
test-publish:
119+
name: Push package to test.pypi.org
120+
if: github.event_name == 'push'
121+
runs-on: ubuntu-latest
122+
needs: [build]
123+
permissions:
124+
attestations: write
125+
id-token: write
126+
127+
steps:
128+
- name: Download packages built by build-and-inspect-python-package
129+
uses: actions/download-artifact@v4
130+
with:
131+
name: Packages
132+
path: dist
133+
134+
- name: Upload package to PyPI
135+
uses: pypa/gh-action-pypi-publish@release/v1
136+
with:
137+
repository-url: https://test.pypi.org/legacy/
138+
skip-existing: true
139+
140+
publish:
141+
name: Publish released package to pypi.org
142+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
143+
runs-on: ubuntu-latest
144+
needs: [test, test-publish]
145+
permissions:
146+
attestations: write
147+
id-token: write
148+
149+
steps:
150+
- name: Download packages built by build-and-inspect-python-package
151+
uses: actions/download-artifact@v4
152+
with:
153+
name: Packages
154+
path: dist
155+
156+
- name: Upload package to PyPI
157+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)