Skip to content

Commit a71704b

Browse files
authored
Update Python publish workflow for releases
1 parent 734d688 commit a71704b

File tree

1 file changed

+42
-17
lines changed

1 file changed

+42
-17
lines changed
Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
# This workflow will upload a Python Package using Twine when a release is created
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3-
41
# This workflow uses actions that are not certified by GitHub.
52
# They are provided by a third-party and are governed by
63
# separate terms of service, privacy policy, and support
74
# documentation.
85

6+
# GitHub recommends pinning actions to a commit SHA.
7+
# To get a newer version, you will need to update the SHA.
8+
# You can also reference a tag or branch, but the action may change without warning.
9+
910
name: Upload Python Package
1011

1112
on:
@@ -16,23 +17,47 @@ permissions:
1617
contents: read
1718

1819
jobs:
19-
deploy:
20+
release-build:
2021
runs-on: ubuntu-latest
2122

2223
steps:
23-
- uses: actions/checkout@v4
24-
- name: "Set up Python"
25-
uses: actions/setup-python@v5
24+
- uses: actions/checkout@v5
25+
26+
- uses: actions/setup-python@v5
2627
with:
27-
python-version-file: "pyproject.toml"
28-
- name: Install dependencies
28+
python-version: "3.x"
29+
30+
- name: Build release distributions
2931
run: |
30-
python -m pip install --upgrade pip
31-
pip install build
32-
- name: Build package
33-
run: python -m build
34-
- name: Publish package
35-
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
32+
# NOTE: put your own distribution build steps here.
33+
python -m pip install build
34+
python -m build
35+
36+
- name: Upload distributions
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: release-dists
40+
path: dist/
41+
42+
pypi-publish:
43+
runs-on: ubuntu-latest
44+
45+
needs:
46+
- release-build
47+
48+
permissions:
49+
id-token: write
50+
51+
environment:
52+
name: pypi
53+
url: https://pypi.org/p/sklx
54+
55+
steps:
56+
- name: Retrieve release distributions
57+
uses: actions/download-artifact@v5
3658
with:
37-
user: __token__
38-
password: ${{ secrets.PYPI_API_TOKEN }}
59+
name: release-dists
60+
path: dist/
61+
62+
- name: Publish release distributions to PyPI
63+
uses: pypa/gh-action-pypi-publish@6f7e8d9c0b1a2c3d4e5f6a7b8c9d0e1f2a3b4c5d

0 commit comments

Comments
 (0)