Skip to content

Commit dabc462

Browse files
authored
Create release.yml
Improved workflow for publishing releases
1 parent a4b2731 commit dabc462

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

.github/workflows/release.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish Python distribution package to PyPI
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
name: Build distribution 📦
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
persist-credentials: false
14+
- name: Set up Python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: "3.x"
18+
- name: Install pypa/build
19+
run: >-
20+
python3 -m
21+
pip install
22+
build
23+
--user
24+
- name: Build a binary wheel and a source tarball
25+
run: python3 -m build
26+
- name: Store the distribution packages
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: python-package-distributions
30+
path: dist/
31+
32+
pypi-publish:
33+
name: Upload release to PyPI
34+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
35+
needs:
36+
- build
37+
runs-on: ubuntu-latest
38+
environment:
39+
name: pypi
40+
url: https://pypi.org/p/bluezero
41+
permissions:
42+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
43+
steps:
44+
- name: Download all the dists
45+
uses: actions/download-artifact@v4
46+
with:
47+
name: python-package-distributions
48+
path: dist/
49+
- name: Publish package distributions to PyPI
50+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)