-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #486 from consideRatio/pr/modern-release-workflow
Update release workflow and RELEASE.md, set version with tbump
- Loading branch information
Showing
7 changed files
with
138 additions
and
108 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# This is a GitHub workflow defining a set of jobs with a set of steps. | ||
# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | ||
# | ||
name: Release | ||
|
||
# Always tests wheel building, but only publish to PyPI on pushed tags. | ||
on: | ||
pull_request: | ||
paths-ignore: | ||
- "docs/**" | ||
- ".github/workflows/*.yaml" | ||
- "!.github/workflows/release.yaml" | ||
push: | ||
paths-ignore: | ||
- "docs/**" | ||
- ".github/workflows/*.yaml" | ||
- "!.github/workflows/release.yaml" | ||
branches-ignore: | ||
- "dependabot/**" | ||
- "pre-commit-ci-update-config" | ||
tags: ["**"] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-release: | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
# id-token=write is required for pypa/gh-action-pypi-publish, and the PyPI | ||
# project needs to be configured to trust this workflow. | ||
# | ||
# ref: https://github.com/jupyterhub/team-compass/issues/648 | ||
# | ||
id-token: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: install build package | ||
run: | | ||
pip install --upgrade pip | ||
pip install build | ||
pip freeze | ||
- name: build release | ||
run: | | ||
python -m build --sdist --wheel . | ||
ls -l dist | ||
- name: publish to pypi | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
if: startsWith(github.ref, 'refs/tags/') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,60 @@ | ||
# How to make a release | ||
|
||
`dockerspawner` is a package [available on | ||
PyPI](https://pypi.org/project/dockerspawner/). | ||
The PyPI release is done automatically by TravisCI when a tag | ||
is pushed. | ||
`dockerspawner` is a package available on [PyPI] and [conda-forge]. | ||
|
||
For you to follow along according to these instructions, you need | ||
to have push rights to the [dockerspawner GitHub | ||
repository](https://github.com/jupyterhub/dockerspawner). | ||
These are the instructions on how to make a release. | ||
|
||
## Pre-requisites | ||
|
||
- Push rights to this GitHub repository | ||
|
||
## Steps to make a release | ||
|
||
1. Checkout main and make sure it is up to date. | ||
1. Create a PR updating `docs/source/changelog.md` with [github-activity] and | ||
continue when its merged. | ||
|
||
```bash | ||
ORIGIN=${ORIGIN:-origin} # set to the canonical remote, e.g. 'upstream' if 'origin' is not the official repo | ||
git checkout main | ||
git fetch $ORIGIN main | ||
git reset --hard $ORIGIN/main | ||
# WARNING! This next command deletes any untracked files in the repo | ||
git clean -xfd | ||
``` | ||
Advice on this procedure can be found in [this team compass | ||
issue](https://github.com/jupyterhub/team-compass/issues/563). | ||
|
||
1. Update [docs/source/changelog.md](docs/source/changelog.md) and add it to | ||
the working tree. | ||
2. Checkout main and make sure it is up to date. | ||
|
||
```bash | ||
git add docs/source/changelog.md | ||
```shell | ||
git checkout main | ||
git fetch origin main | ||
git reset --hard origin/main | ||
``` | ||
|
||
Tip: Identifying the changes can be made easier with the help of the | ||
[executablebooks/github-activity](https://github.com/executablebooks/github-activity) | ||
utility. | ||
3. Update the version, make commits, and push a git tag with `tbump`. | ||
|
||
1. Set the `version_info` variable in [\_version.py](dockerspawner/_version.py) | ||
appropriately and make a commit. | ||
|
||
```bash | ||
git add dockerspawner/_version.py | ||
VERSION=... # e.g. 1.2.3 | ||
git commit -m "release $VERSION" | ||
```shell | ||
pip install tbump | ||
``` | ||
|
||
Tip: You can get the current project version by checking the [latest | ||
tag on GitHub](https://github.com/jupyterhub/dockerspawner/tags). | ||
|
||
1. Create a git tag for the release commit. | ||
`tbump` will ask for confirmation before doing anything. | ||
|
||
```bash | ||
git tag -a $VERSION -m "release $VERSION" | ||
# then verify you tagged the right commit | ||
git log | ||
```shell | ||
# Example versions to set: 1.0.0, 1.0.0b1 | ||
VERSION= | ||
tbump ${VERSION} | ||
``` | ||
|
||
1. Reset the `version_info` variable in | ||
[\_version.py](dockerspawner/_version.py) appropriately with an incremented | ||
patch version and a `dev` element, then make a commit. | ||
Following this, the [CI system] will build and publish a release. | ||
|
||
```bash | ||
git add dockerspawner/_version.py | ||
git commit -m "back to dev" | ||
4. Reset the version back to dev, e.g. `1.0.1.dev` after releasing `1.0.0`. | ||
|
||
```shell | ||
# Example version to set: 1.0.1.dev | ||
NEXT_VERSION= | ||
tbump --no-tag ${NEXT_VERSION}.dev | ||
``` | ||
|
||
1. Push your two commits. | ||
5. Following the release to PyPI, an automated PR should arrive within 24 hours | ||
to [conda-forge/dockerspawner-feedstock] with instructions on releasing to | ||
conda-forge. You are welcome to volunteer doing this, but aren't required as | ||
part of making this release to PyPI. | ||
|
||
```bash | ||
git push $ORIGIN main --follow-tags | ||
``` | ||
[github-activity]: https://github.com/executablebooks/github-activity | ||
[pypi]: https://pypi.org/project/dockerspawner/ | ||
[conda-forge]: https://anaconda.org/conda-forge/dockerspawner | ||
[conda-forge/dockerspawner-feedstock]: https://github.com/conda-forge/dockerspawner-feedstock | ||
[ci system]: https://github.com/jupyterhub/dockerspawner/actions/workflows/release.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,7 @@ | ||
"""dockerspawner version info""" | ||
# Copyright (c) Jupyter Development Team. | ||
# Distributed under the terms of the Modified BSD License. | ||
# __version__ should be updated using tbump, based on configuration in | ||
# pyproject.toml, according to instructions in RELEASE.md. | ||
# | ||
__version__ = "12.2.0.dev" | ||
|
||
version_info = ( | ||
12, | ||
2, | ||
0, | ||
'dev', # comment-out this line for a release | ||
) | ||
__version__ = '.'.join(map(str, version_info[:3])) | ||
|
||
if len(version_info) > 3: | ||
__version__ = '%s%s' % (__version__, version_info[3]) | ||
# version_info looks like (1, 2, 3, "dev") if __version__ is 1.2.3.dev | ||
version_info = tuple(int(p) if p.isdigit() else p for p in __version__.split(".")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters