Skip to content

Commit ac1c60c

Browse files
authored
Merge pull request #50 from ksunden/trusted_pub
Add pypi trusted publisher workflow
2 parents 471a248 + 46eeb8e commit ac1c60c

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

.github/workflows/release.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
3+
name: Release
4+
on:
5+
release:
6+
types:
7+
- published
8+
9+
jobs:
10+
build:
11+
name: Build Release Packages
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 10
17+
18+
- name: Set up Python
19+
id: setup
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: 3.x
23+
24+
- name: Install build tools
25+
run: |
26+
python -m pip install --upgrade pip
27+
python -m pip install --upgrade build
28+
29+
- name: Build packages
30+
run: python -m build
31+
32+
- name: Save built packages as artifact
33+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
34+
with:
35+
name: packages-${{ runner.os }}-${{ steps.setup.outputs.python-version }}
36+
path: dist/
37+
if-no-files-found: error
38+
retention-days: 5
39+
40+
publish:
41+
name: Upload release to PyPI
42+
needs: build
43+
runs-on: ubuntu-latest
44+
environment: release
45+
permissions:
46+
id-token: write
47+
steps:
48+
- name: Download packages
49+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
50+
with:
51+
pattern: packages-*
52+
path: dist
53+
merge-multiple: true
54+
55+
- name: Print out packages
56+
run: ls dist
57+
58+
- name: Generate artifact attestation for sdist and wheel
59+
uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0
60+
with:
61+
subject-path: dist/cycler-*
62+
63+
- name: Publish package distributions to PyPI
64+
uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.3

0 commit comments

Comments
 (0)