Skip to content

Commit 9a20b59

Browse files
first draft of pypi action
1 parent bcc3d5e commit 9a20b59

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/publish.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Based on template at https://docs.github.com/en/enterprise-cloud@latest/actions/use-cases-and-examples/building-and-testing/building-and-testing-python?learn=continuous_integration#publishing-to-pypi
2+
3+
name: Publish to PyPI
4+
5+
on:
6+
release:
7+
types: [published]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
release-build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.x"
22+
23+
- name: Build release distributions
24+
run: |
25+
python -m pip install build
26+
python -m build
27+
28+
- name: Upload distributions
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: release-dists
32+
path: dist/
33+
34+
pypi-publish:
35+
runs-on: ubuntu-latest
36+
37+
needs:
38+
- release-build
39+
40+
permissions:
41+
# IMPORTANT: this permission is mandatory for trusted publishing
42+
id-token: write
43+
44+
# Dedicated environments with protections for publishing are strongly recommended.
45+
environment:
46+
name: pypi
47+
url: https://pypi.org/p/unit-scaling
48+
49+
steps:
50+
- name: Retrieve release distributions
51+
uses: actions/download-artifact@v4
52+
with:
53+
name: release-dists
54+
path: dist/
55+
56+
- name: Publish release distributions to PyPI
57+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)