Skip to content

Commit 2ef0b16

Browse files
authored
Merge pull request #12 from gaussian/develop
Fix PyPI trusted publishing and bump Actions to Node.js 24
2 parents d6b6fc4 + 2f39f9a commit 2ef0b16

File tree

2 files changed

+52
-49
lines changed

2 files changed

+52
-49
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ jobs:
1919
steps:
2020

2121
- name: Check out code
22-
uses: actions/checkout@v4
22+
uses: actions/checkout@v6
2323
with:
2424
ref: main
2525
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
2626

2727
- name: Set up Python
28-
uses: actions/setup-python@v5
28+
uses: actions/setup-python@v6
2929
with:
3030
python-version: '3.x'
3131
# cache: 'pip'
@@ -118,18 +118,16 @@ jobs:
118118
git push origin v${{ steps.versioning.outputs.newVersion }}
119119
120120
- name: Create GitHub Release
121-
id: create_release
122-
uses: softprops/action-gh-release@v2
123-
with:
124-
tag_name: v${{ steps.versioning.outputs.newVersion }}
125-
name: v${{ steps.versioning.outputs.newVersion }}
126-
draft: false
127-
prerelease: false
128-
token: ${{ secrets.GITHUB_TOKEN }}
129-
generate_release_notes: true
121+
run: |
122+
gh release create \
123+
"v${{ steps.versioning.outputs.newVersion }}" \
124+
--title "v${{ steps.versioning.outputs.newVersion }}" \
125+
--generate-notes
126+
env:
127+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130128

131129
- name: Checkout the merged development branch
132-
uses: actions/checkout@v4
130+
uses: actions/checkout@v6
133131
with:
134132
ref: ${{ github.head_ref }} # This is the branch that was merged into main
135133
fetch-depth: 0 # Fetch all history for all branches and tags
@@ -143,40 +141,3 @@ jobs:
143141
git merge origin/main --no-edit -X ours
144142
# If conflicts arise and are resolved, or if no conflicts occur, proceed to push
145143
git push origin HEAD:${{ github.head_ref }}
146-
147-
- name: Build release distributions
148-
run: |
149-
python -m pip install build
150-
python -m build
151-
152-
- name: Store the distribution packages
153-
uses: actions/upload-artifact@v6
154-
with:
155-
name: python-package-distributions
156-
path: dist/
157-
158-
publish-to-pypi:
159-
name: >-
160-
Publish Python 🐍 distribution 📦 to PyPI
161-
162-
needs:
163-
- build-new-version
164-
165-
runs-on: ubuntu-latest
166-
167-
environment:
168-
name: pypi
169-
url: https://pypi.org/p/shots
170-
171-
permissions:
172-
id-token: write # IMPORTANT: mandatory for trusted publishing
173-
174-
steps:
175-
- name: Download all the dists
176-
uses: actions/download-artifact@v7
177-
with:
178-
name: python-package-distributions
179-
path: dist/
180-
181-
- name: Publish distribution 📦 to PyPI
182-
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/publish.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Release New Version"]
6+
types: [completed]
7+
8+
jobs:
9+
publish-to-pypi:
10+
name: Publish Python distribution to PyPI
11+
if: github.event.workflow_run.conclusion == 'success'
12+
runs-on: ubuntu-latest
13+
14+
environment:
15+
name: pypi
16+
url: https://pypi.org/p/shots
17+
18+
permissions:
19+
id-token: write
20+
21+
steps:
22+
- name: Check out code
23+
uses: actions/checkout@v6
24+
with:
25+
ref: main
26+
fetch-depth: 0
27+
28+
- name: Checkout latest version tag
29+
run: git checkout $(git describe --tags --abbrev=0)
30+
31+
- name: Set up Python
32+
uses: actions/setup-python@v6
33+
with:
34+
python-version: '3.x'
35+
36+
- name: Build release distributions
37+
run: |
38+
python -m pip install build
39+
python -m build
40+
41+
- name: Publish distribution to PyPI
42+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)