-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialize release docs and automation
- Loading branch information
1 parent
ba6a1c7
commit 36aaf7c
Showing
6 changed files
with
247 additions
and
13 deletions.
There are no files selected for viewing
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,134 @@ | ||
# 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 | ||
# | ||
# Publish PyPI and NPM artifacts | ||
# | ||
name: Release | ||
|
||
on: | ||
pull_request: | ||
paths-ignore: | ||
- "**.md" | ||
- ".github/workflows/*" | ||
- "!.github/workflows/release.yaml" | ||
push: | ||
paths-ignore: | ||
- "**.md" | ||
- ".github/workflows/*" | ||
- "!.github/workflows/release.yaml" | ||
branches-ignore: | ||
- "dependabot/**" | ||
- "pre-commit-ci-update-config" | ||
tags: | ||
- "*" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "lts/*" | ||
registry-url: https://registry.npmjs.org | ||
|
||
- name: Update root build packages | ||
run: | | ||
pip install --upgrade build pip | ||
- name: Build dist | ||
run: | | ||
pyproject-build | ||
cd dist && sha256sum * | tee SHA256SUMS | ||
- name: Check dist sizes | ||
run: | | ||
set -eux | ||
ls -lathr dist | ||
[[ $(find dist -type f -size +200k) ]] && exit 1 || echo ok | ||
- name: Javascript package | ||
run: | | ||
mkdir jsdist | ||
cd jsdist | ||
npm pack ../jupyter_launcher_shortcuts/labextension | ||
sha256sum * | tee SHA256SUMS | ||
- name: Upload Python artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist-${{ github.run_attempt }} | ||
path: dist | ||
if-no-files-found: error | ||
|
||
- name: Upload Javascript artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: jsdist-${{ github.run_attempt }} | ||
path: jsdist | ||
if-no-files-found: error | ||
|
||
# https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ | ||
publish-pypi: | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
id-token: write | ||
needs: | ||
- build | ||
|
||
steps: | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Download artifacts from build | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: dist-${{ github.run_attempt }} | ||
path: dist | ||
|
||
# The PyPI publishing action will try to publish this checksum file as if | ||
# it was a Python package if it remains in dist, so we clean it up first. | ||
- name: Cleanup SHA256SUMS | ||
run: | | ||
cat dist/SHA256SUMS | ||
rm dist/SHA256SUMS | ||
- name: Publish to PyPI | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_PASSWORD }} | ||
|
||
# https://docs.github.com/en/actions/language-and-framework-guides/publishing-nodejs-packages#publishing-packages-to-the-npm-registry | ||
publish-npm: | ||
runs-on: ubuntu-22.04 | ||
needs: | ||
- build | ||
|
||
steps: | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "lts/*" | ||
|
||
- name: Download artifacts from build | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: jsdist-${{ github.run_attempt }} | ||
path: jsdist | ||
|
||
- run: | | ||
npm publish --dry-run ./jsdist/jupyter_launcher_shortcuts-*.tgz | ||
- run: | | ||
npm publish ./jsdist/jupyter_launcher_shortcuts-*.tgz | ||
if: startsWith(github.ref, 'refs/tags') | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
# Changelog |
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,44 @@ | ||
# How to make a release | ||
|
||
`jupyter-launcher-shortcuts` is a package available on [PyPI]. These are | ||
instructions on how to make a release. | ||
|
||
## Pre-requisites | ||
|
||
- Push rights to [github.com/2i2c-org/jupyter-launcher-shortcuts] | ||
|
||
## Steps to make a release | ||
|
||
1. Create a PR updating `CHANGELOG.md` with [github-activity] and continue only | ||
when its merged. | ||
|
||
2. Checkout main and make sure it is up to date. | ||
|
||
```shell | ||
git checkout main | ||
git fetch origin main | ||
git reset --hard origin/main | ||
``` | ||
|
||
3. Update the version, make commits, and push a git tag with `tbump`. | ||
|
||
```shell | ||
pip install tbump | ||
tbump --dry-run ${VERSION} | ||
|
||
# run | ||
tbump ${VERSION} | ||
``` | ||
|
||
Following this, the [CI system] will build and publish a release. | ||
|
||
4. Reset the version back to dev, e.g. `4.0.1-0.dev` after releasing `4.0.0`. | ||
|
||
```shell | ||
tbump --no-tag ${NEXT_VERSION}-0.dev | ||
``` | ||
|
||
[github-activity]: https://github.com/executablebooks/github-activity | ||
[github.com/2i2c-org/jupyter-launcher-shortcuts]: https://github.com/2i2c-org/jupyter-launcher-shortcuts | ||
[pypi]: https://pypi.org/project/jupyter-launcher-shortcuts/ | ||
[ci system]: https://github.com/2i2c-org/jupyter-launcher-shortcuts/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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# __version__ should be updated using tbump, based on configuration in | ||
# pyproject.toml, according to instructions in RELEASE.md. | ||
# | ||
__version__ = "4.0.0-0.dev" |
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