Skip to content

Commit d946535

Browse files
Merge pull request #56 from agriyakhetarpal/update/publishing-workflow
Update PyPI publishing workflow
2 parents a387d67 + 7030104 commit d946535

File tree

2 files changed

+70
-27
lines changed

2 files changed

+70
-27
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -49,30 +49,3 @@ jobs:
4949
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
5050
with:
5151
token: ${{ secrets.CODECOV_TOKEN }}
52-
53-
deploy:
54-
runs-on: ubuntu-latest
55-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
56-
environment: PyPi-deploy
57-
steps:
58-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
59-
with:
60-
fetch-depth: 0
61-
fetch-tags: true
62-
persist-credentials: false
63-
64-
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
65-
with:
66-
python-version: 3.10.2
67-
68-
- name: Install requirements and build wheel
69-
shell: bash -l {0}
70-
run: |
71-
python -m pip install build twine
72-
python -m build .
73-
74-
- name: Publish package
75-
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
76-
with:
77-
user: __token__
78-
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/release.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
schedule:
8+
- cron: "0 3 * * 1"
9+
10+
permissions: {}
11+
12+
env:
13+
FORCE_COLOR: 3
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20+
with:
21+
# include tags so that hatch-vcs can infer the version
22+
fetch-depth: 0
23+
# switch to fetch-tags: true when the following is fixed
24+
# see https://github.com/actions/checkout/issues/2041
25+
# fetch-tags: true
26+
persist-credentials: false
27+
28+
- name: Setup Python
29+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
30+
with:
31+
python-version: "3.12"
32+
33+
- name: Build the distribution packages
34+
run: |
35+
python -m pip install build
36+
python -m build .
37+
38+
- name: Store the distribution packages
39+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
40+
with:
41+
name: python-package-distributions
42+
path: dist/
43+
if-no-files-found: error
44+
45+
publish:
46+
name: Publish to PyPI
47+
needs: [build]
48+
runs-on: ubuntu-latest
49+
if: github.event_name == 'release' && github.event.action == 'published'
50+
environment:
51+
name: pypi
52+
url: https://pypi.org/p/pyodide-pack
53+
permissions:
54+
id-token: write # IMPORTANT: mandatory for trusted publishing
55+
attestations: write
56+
contents: read
57+
steps:
58+
- name: Download all the dists
59+
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
60+
with:
61+
path: dist/
62+
merge-multiple: true
63+
64+
- name: Generate artifact attestations
65+
uses: actions/attest-build-provenance@c074443f1aee8d4aeeae555aebba3282517141b2 # v2.2.3
66+
with:
67+
subject-path: "dist/*"
68+
69+
- name: Publish distribution 📦 to PyPI
70+
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4

0 commit comments

Comments
 (0)