Skip to content

Commit 15b644b

Browse files
Use trusted publishing to publish to PyPI
See SuffolkLITLab/ALActions#73 for more info.
1 parent 9572b19 commit 15b644b

1 file changed

Lines changed: 44 additions & 8 deletions

File tree

.github/workflows/publish.yml

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,49 @@
1-
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
1+
name: Publish Python distribution to PyPI
22

3-
on: push
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
48

59
jobs:
6-
build-n-publish:
7-
name: Build and publish Python 🐍 distributions 📦 to PyPI
10+
build:
11+
name: Build distribution
812
runs-on: ubuntu-latest
913
steps:
10-
- uses: SuffolkLITLab/ALActions/publish@main
11-
with:
12-
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
13-
VERSION_TO_PUBLISH: ${{ env.GITHUB_REF_NAME }}
14+
- uses: actions/checkout@v6
15+
with:
16+
persist-credentials: false
17+
- name: Set up Python
18+
uses: actions/setup-python@v6
19+
with:
20+
python-version: "3.12"
21+
- name: Install build tool
22+
run: python3 -m pip install --user build
23+
- name: Build a binary wheel and source tarball
24+
run: python3 -m build
25+
- name: Store 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: Publish distribution to PyPI
33+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
34+
needs:
35+
- build
36+
runs-on: ubuntu-latest
37+
environment:
38+
name: pypi
39+
url: https://pypi.org/p/formfyxer
40+
permissions:
41+
id-token: write
42+
steps:
43+
- name: Download all distributions
44+
uses: actions/download-artifact@v4
45+
with:
46+
name: python-package-distributions
47+
path: dist/
48+
- name: Publish distribution to PyPI
49+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)