Skip to content

Commit 2b41280

Browse files
committed
ci: Simplify release, by using PyPI publish GitHub Action
1 parent dbecb74 commit 2b41280

File tree

5 files changed

+54
-2
lines changed

5 files changed

+54
-2
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This job publishes a release on PyPI when a Git tag is pushed.
2+
# See RELEASE.txt for further instructions.
3+
name: Publish release on PyPI
4+
5+
on: push
6+
7+
jobs:
8+
publish-to-pypi:
9+
name: Publish release on PyPI
10+
if: startsWith(github.ref, 'refs/tags/')
11+
runs-on: ubuntu-latest
12+
environment:
13+
name: pypi
14+
url: https://pypi.org/p/zbarlight
15+
permissions:
16+
id-token: write # mandatory for trusted publishing
17+
18+
steps:
19+
- uses: actions/checkout@v6
20+
- name: Set up Python
21+
uses: actions/setup-python@v6
22+
with:
23+
python-version: "3.14"
24+
- name: Install pypa/build
25+
run: pip install build
26+
- name: Build a binary wheel and a source tarball
27+
run: python3 -m build
28+
- name: Publish distribution to PyPI
29+
uses: pypa/gh-action-pypi-publish@release/v1

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ prune docs
33
prune tests
44
global-exclude *.py[cod] __pycache__ *.so
55

6-
include Changelog.rst LICENSE README.rst
6+
include Changelog.rst LICENSE README.rst RELEASE.txt
77
exclude Makefile requirements-dev.txt run.py .readthedocs.yaml

RELEASE.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Release is done through `zest.releaser` and a GitHub CI job:
2+
3+
1. Make sure that your `master` branch is up-to-date:
4+
5+
$ git checkout master
6+
$ git reset origin/master --hard
7+
$ make clean
8+
9+
2. Run `zest.releaser`:
10+
11+
$ fullrelease
12+
13+
14+
It will update the version number, push a Git tag and update the
15+
version number again for the next release.
16+
17+
3. Wait for the GitHub CI job to (automatically) run and publish the
18+
release on PyPI.

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,8 @@ disable = [
9292
"unused-argument",
9393
"wrong-import-order",
9494
]
95+
96+
97+
[tool.zest-releaser]
98+
# Do not let zest.releaser upload to PyPI. It's done by a GitHub CI job.
99+
upload-pypi = false

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ pytest
1515
vulture
1616

1717
# Release
18-
zest.releaser[recommended]
18+
zest.releaser
1919
polydev-github

0 commit comments

Comments
 (0)