Skip to content

Commit 69cc258

Browse files
committed
ci: publish releases to PyPI via Trusted Publishing
1 parent a7058d8 commit 69cc258

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: release
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
ref:
9+
description: 'Git tag to build and publish (e.g. v4.6.0)'
10+
required: true
11+
type: string
12+
13+
jobs:
14+
build:
15+
name: Build distributions
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v6
19+
with:
20+
ref: ${{ inputs.ref || github.ref }}
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v7
23+
- name: Build sdist and wheel
24+
run: uv build --no-sources
25+
- name: Verify wheel contains only the progressbar package
26+
run: |
27+
unpacked="$(unzip -Z1 dist/*.whl | cut -d/ -f1 | sort -u)"
28+
echo "$unpacked"
29+
test "$(echo "$unpacked" | grep -cvE '^progressbar$|^progressbar2-.*\.dist-info$')" -eq 0
30+
- uses: actions/upload-artifact@v6
31+
with:
32+
name: dist
33+
path: dist/
34+
35+
publish:
36+
name: Publish to PyPI
37+
needs: build
38+
runs-on: ubuntu-latest
39+
environment:
40+
name: pypi
41+
url: https://pypi.org/project/progressbar2/
42+
permissions:
43+
id-token: write
44+
steps:
45+
- uses: actions/download-artifact@v7
46+
with:
47+
name: dist
48+
path: dist/
49+
- name: Publish via Trusted Publishing
50+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)