Skip to content

Commit c585f3b

Browse files
committed
Use OpenID Connect to publish releases on PyPi & NPMJS
1 parent 834d4d9 commit c585f3b

File tree

2 files changed

+35
-30
lines changed

2 files changed

+35
-30
lines changed

.github/workflows/release.yml

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,52 @@ name: Release
33
on:
44
release:
55
types: [published]
6+
workflow_dispatch:
67

78
jobs:
8-
PyPI:
9+
pypi-build:
910
runs-on: ubuntu-latest
11+
1012
steps:
1113
- uses: actions/checkout@v5
1214
- uses: actions/setup-python@v6
1315
with:
1416
python-version: "3.x"
15-
- run: python -m pip install --upgrade pip build wheel twine
16-
- name: Build dist packages
17-
run: python -m build --sdist --wheel
18-
- run: python -m twine upload dist/*
19-
env:
20-
TWINE_USERNAME: __token__
21-
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
17+
- run: python -m pip install --upgrade pip build wheel
18+
- run: python -m build --sdist --wheel
19+
- uses: actions/upload-artifact@v4
20+
with:
21+
name: release-dists
22+
path: dist/
2223

23-
npm:
24+
pypi-publish:
2425
runs-on: ubuntu-latest
26+
needs:
27+
- pypi-build
28+
permissions:
29+
id-token: write
30+
31+
steps:
32+
- uses: actions/download-artifact@v5
33+
with:
34+
name: release-dists
35+
path: dist/
36+
- uses: pypa/gh-action-pypi-publish@release/v1
37+
38+
npmjs:
39+
name: npmjs.org
40+
runs-on: ubuntu-latest
41+
permissions:
42+
id-token: write
2543
steps:
2644
- uses: actions/checkout@v5
2745
- uses: actions/setup-node@v6
28-
- uses: actions/setup-python@v6
2946
with:
30-
python-version: "3.x"
31-
- run: python -m pip install --upgrade setuptools_scm
32-
- run: python set_version.py
33-
- name: Upload packages
34-
run: npm publish
35-
env:
36-
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
47+
node-version-file: .nvmrc
48+
registry-url: 'https://registry.npmjs.org'
49+
- run: npm install -g npm@latest
50+
- run: npm ci
51+
- run: npm config set git-tag-version=false
52+
- run: npm version ${{ github.event.release.tag_name }}
53+
- run: npm run build --if-present
54+
- run: npm publish

set_version.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)