Skip to content

Commit 5df5f76

Browse files
New release.yml to update package to pypi
1 parent bd9b4a1 commit 5df5f76

1 file changed

Lines changed: 47 additions & 18 deletions

File tree

.github/workflows/release.yml

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,53 @@
1+
name: Publish to PyPI
2+
on:
3+
release:
4+
types: [published]
15
jobs:
2-
pypi-publish:
3-
name: upload release to PyPI
6+
build:
7+
name: Build distribution 📦
48
runs-on: ubuntu-latest
5-
environment:
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+
19+
- name: Install pypa/build
20+
run: >-
21+
python3 -m
22+
pip install
23+
build
24+
--user
25+
- name: Build a binary wheel and a source tarball
26+
run: python3 -m build
27+
- name: Store the distribution packages
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: python-package-distributions
31+
path: dist/
32+
33+
publish-to-pypi:
34+
name: >-
35+
Publish to PyPI
36+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
37+
needs:
38+
- build
39+
runs-on: ubuntu-latest
40+
environment:
641
name: pypi
742
url: https://pypi.org/p/rov
843
permissions:
9-
id-token: write # Required for Trusted Publishing
44+
id-token: write # IMPORTANT: mandatory for trusted publishing
45+
1046
steps:
11-
- uses: actions/checkout@v4
12-
- name: Set up Python
13-
uses: actions/setup-python@v5
14-
with:
15-
python-version: '3.13'
16-
- name: Install dependencies
17-
run: |
18-
python -m pip install --upgrade pip
19-
pip install build
20-
pip install -r requirements.txt
21-
- name: Build package
22-
run: python -m build
23-
- name: Publish package distributions to PyPI
24-
uses: pypa/gh-action-pypi-publish@release/v1
47+
- name: Download all the dists
48+
uses: actions/download-artifact@v4
49+
with:
50+
name: python-package-distributions
51+
path: dist/
52+
- name: Publish distribution 📦 to PyPI
53+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)