Skip to content

Commit 220db61

Browse files
rajeswari1301BryceStevenWilley
authored andcommitted
Switched to pypi trusted publishing
Replaces the old PYPI_API_TOKEN publishing with PyPI's trusted publishing. This removes the need to store API secrets and generates temporary tokens automatically for each publish run.
1 parent d37f3f9 commit 220db61

File tree

1 file changed

+44
-9
lines changed

1 file changed

+44
-9
lines changed

.github/workflows/publish.yml

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +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-
TEAMS_BUMP_WEBHOOK: ${{ secrets.TEAMS_BUMP_WEBHOOK }}
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/docassemble-alweaver
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)