Skip to content

Commit 76ae0ca

Browse files
committed
ci: use trusted publishing
1 parent 12648d9 commit 76ae0ca

File tree

1 file changed

+43
-16
lines changed

1 file changed

+43
-16
lines changed

.github/workflows/publish.yml

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,48 @@ on:
44
tags:
55
- '*.*.*'
66
jobs:
7-
build-and-publish:
8-
name: Build and publish Miniflux's Python package
7+
build:
8+
name: Build distribution 📦
99
runs-on: ubuntu-latest
10+
1011
steps:
11-
- uses: actions/checkout@v4
12-
- uses: actions/setup-python@v5
13-
with:
14-
python-version: '3.x'
15-
- name: Install pypa/build
16-
run: >-
17-
python -m pip install build --user
18-
- name: Build a binary wheel and a source tarball
19-
run: >-
20-
python -m build --sdist --wheel --outdir dist/ .
21-
- name: Publish to PyPI
22-
uses: pypa/gh-action-pypi-publish@release/v1
23-
with:
24-
password: ${{ secrets.PYPI_API_TOKEN }}
12+
- uses: actions/checkout@v4
13+
- name: Set up Python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: "3.x"
17+
- name: Install pypa/build
18+
run: >-
19+
python3 -m
20+
pip install
21+
build
22+
--user
23+
- name: Build a binary wheel and a source tarball
24+
run: python3 -m build
25+
- name: Store the distribution packages
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: python-package-distributions
29+
path: dist/
30+
31+
publish-to-pypi:
32+
name: >-
33+
Publish Python 🐍 distribution 📦 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/miniflux
41+
permissions:
42+
id-token: write # IMPORTANT: mandatory for trusted publishing
43+
44+
steps:
45+
- name: Download all the dists
46+
uses: actions/download-artifact@v4
47+
with:
48+
name: python-package-distributions
49+
path: dist/
50+
- name: Publish distribution 📦 to PyPI
51+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)