Skip to content

Commit 9fbe2fd

Browse files
committed
Add github actions based release automation
1 parent b947d24 commit 9fbe2fd

File tree

3 files changed

+142
-0
lines changed

3 files changed

+142
-0
lines changed

.github/workflows/release.yaml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This is a GitHub workflow defining a set of jobs with a set of steps.
2+
# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
3+
#
4+
name: Release
5+
6+
# Always tests wheel building, but only publish to PyPI on pushed tags.
7+
on:
8+
pull_request:
9+
paths-ignore:
10+
- "**.md"
11+
- ".github/workflows/*.yaml"
12+
- "!.github/workflows/release.yaml"
13+
push:
14+
paths-ignore:
15+
- "**.md"
16+
- ".github/workflows/*.yaml"
17+
- "!.github/workflows/release.yaml"
18+
branches-ignore:
19+
- "dependabot/**"
20+
- "pre-commit-ci-update-config"
21+
tags: ["**"]
22+
workflow_dispatch:
23+
24+
jobs:
25+
build-release:
26+
runs-on: ubuntu-24.04
27+
permissions:
28+
# id-token=write is required for pypa/gh-action-pypi-publish, and the PyPI
29+
# project needs to be configured to trust this workflow.
30+
#
31+
# ref: https://github.com/jupyterhub/team-compass/issues/648
32+
#
33+
id-token: write
34+
35+
steps:
36+
- uses: actions/checkout@v4
37+
- uses: actions/setup-python@v5
38+
with:
39+
python-version: "3.12"
40+
41+
- name: install build package
42+
run: |
43+
pip install --upgrade pip
44+
pip install build
45+
pip freeze
46+
47+
- name: build release
48+
run: |
49+
python -m build --sdist --wheel .
50+
ls -l dist
51+
52+
- name: publish to pypi
53+
uses: pypa/gh-action-pypi-publish@release/v1
54+
if: startsWith(github.ref, 'refs/tags/')

RELEASE.md

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# How to make a release
2+
3+
`jupyterhub-python-repo-template` is a package available on [PyPI] and
4+
[conda-forge].
5+
6+
These are the instructions on how to make a release.
7+
8+
## Pre-requisites
9+
10+
- Push rights to this GitHub repository
11+
12+
## Steps to make a release
13+
14+
1. Create a PR updating `CHANGELOG.md` with [github-activity] and continue when
15+
its merged. For details about this, see the [team-compass documentation]
16+
about it.
17+
18+
[team-compass documentation]: https://jupyterhub-team-compass.readthedocs.io/en/latest/practices/releases.html
19+
20+
2. Checkout main and make sure it is up to date.
21+
22+
```shell
23+
git checkout main
24+
git fetch origin main
25+
git reset --hard origin/main
26+
```
27+
28+
3. Update the version, make commits, and push a git tag with `tbump`.
29+
30+
```shell
31+
pip install tbump
32+
```
33+
34+
`tbump` will ask for confirmation before doing anything.
35+
36+
```shell
37+
# Example versions to set: 1.0.0, 1.0.0b1
38+
VERSION=
39+
tbump ${VERSION}
40+
```
41+
42+
Following this, the [CI system] will build and publish a release.
43+
44+
4. Reset the version back to dev, e.g. `1.0.1.dev` after releasing `1.0.0`.
45+
46+
```shell
47+
# Example version to set: 1.0.1.dev
48+
NEXT_VERSION=
49+
tbump --no-tag ${NEXT_VERSION}.dev
50+
```
51+
52+
5. Following the release to PyPI, an automated PR should arrive within 24 hours
53+
to [conda-forge/jupyterhub-python-repo-template-feedstock] with instructions
54+
on releasing to conda-forge. You are welcome to volunteer doing this, but
55+
aren't required as part of making this release to PyPI.
56+
57+
[github-activity]: https://github.com/executablebooks/github-activity
58+
[pypi]: https://pypi.org/project/jupyterhub-python-repo-template/
59+
[conda-forge]: https://anaconda.org/conda-forge/jupyterhub-python-repo-template
60+
[conda-forge/jupyterhub-python-repo-template-feedstock]: https://github.com/conda-forge/jupyterhub-python-repo-template-feedstock
61+
[ci system]: https://github.com/jupyterhub/jupyterhub-python-repo-template/actions/workflows/release.yaml

pyproject.toml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# tbump is used to simplify and standardize the release process when updating
2+
# the version, making a git commit and tag, and pushing changes.
3+
#
4+
# ref: https://github.com/your-tools/tbump#readme
5+
#
6+
[tool.tbump]
7+
github_url = "https://github.com/jupyterhub/jupyter-rsession-proxy"
8+
9+
[tool.tbump.version]
10+
current = "2.2.1"
11+
regex = '''
12+
(?P<major>\d+)
13+
\.
14+
(?P<minor>\d+)
15+
\.
16+
(?P<patch>\d+)
17+
(?P<pre>((a|b|rc)\d+)|)
18+
\.?
19+
(?P<dev>(?<=\.)dev\d*|)
20+
'''
21+
22+
[tool.tbump.git]
23+
message_template = "Bump to v{new_version}"
24+
tag_template = "v{new_version}"
25+
26+
[[tool.tbump.file]]
27+
src = "setup.py"

0 commit comments

Comments
 (0)