Add workflow to automate releases (#83)

* Add workflow to automate releases

* Tmp: Change to trigger to test the workflow

* Add step to generate the changelog

* Update changelog command

* Tweak changelog

* Pass github token to the docker container

* Get previous tag for changelog

* Fix docker command

* wip workflow

* debug workflow

* Debug tag

* Add defaults for bash

* Add fetch depth to checkout

* Use real tag in GH Action step

* Create draft release for testing

* Tweak CHANGELOG

* More tweaks

* Update release instructions

* Tweak changelog

* Ensure build and release share common test jobs

* Upload artifacts to PyPI

* Prepare dist/

* Copy the wheel

* Update workflow to trigger on tags

* Test on TestPyPI

* Test API token

* Add TODO

* skip existing

* Switch to tags
Jeremy Tuloup 5 years ago committed by GitHub
parent ccbc84aee3
commit 23dd0cbb8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -14,7 +14,19 @@ defaults:
shell: bash -l {0}
jobs:
integrity:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build checksum file
run: |
sed -n 17,146p .github/workflows/build.yml > build
sed -n 17,146p .github/workflows/release.yml > release
diff build release
test:
needs: [integrity]
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -49,6 +61,7 @@ jobs:
jlpm run test
build:
needs: [integrity]
runs-on: ubuntu-latest
steps:
- name: Checkout

@ -0,0 +1,217 @@
name: Release
on:
push:
tags:
- '*'
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
defaults:
run:
shell: bash -l {0}
jobs:
integrity:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build checksum file
run: |
sed -n 17,146p .github/workflows/build.yml > build
sed -n 17,146p .github/workflows/release.yml > release
diff build release
test:
needs: [integrity]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '14.x'
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install jupyter_packaging
- name: Install the package
run: |
python -m pip install .
jupyter labextension list 2>&1 | grep -ie "@jupyterlab-classic/lab-extension.*enabled.*ok" -
jupyter server extension list 2>&1 | grep -ie "jupyterlab_classic.*enabled" -
python -m jupyterlab.browser_check
- name: Lint
run: |
jlpm
jlpm run eslint:check
jlpm run prettier:check
- name: Test
run: |
jlpm run build:test
jlpm run test
build:
needs: [integrity]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '14.x'
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install setuptools jupyter_packaging "jupyterlab>=3,<4"
- name: Build pypi distributions
run: |
python setup.py sdist bdist_wheel
- name: Build npm distributions
run: |
jlpm lerna exec -- npm pack
cp packages/*/*.tgz dist
- name: Build checksum file
run: |
cd dist
sha256sum * | tee SHA256SUMS
- name: Upload distributions
uses: actions/upload-artifact@v2
with:
name: dist ${{ github.run_number }}
path: ./dist
install:
runs-on: ${{ matrix.os }}-latest
needs: [build]
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
python: ['3.6', '3.9']
include:
- python: '3.6'
dist: 'jupyterlab-classic*.tar.gz'
- python: '3.9'
dist: 'jupyterlab_classic*.whl'
- os: windows
py_cmd: python
- os: macos
py_cmd: python3
- os: ubuntu
py_cmd: python
steps:
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
architecture: 'x64'
- uses: actions/download-artifact@v2
with:
name: dist ${{ github.run_number }}
path: ./dist
- name: Install the prerequisites
run: |
${{ matrix.py_cmd }} -m pip install pip wheel
- name: Install the package
run: |
cd dist
${{ matrix.py_cmd }} -m pip install -vv ${{ matrix.dist }}
- name: Validate environment
run: |
${{ matrix.py_cmd }} -m pip freeze
${{ matrix.py_cmd }} -m pip check
- name: Validate the install
run: |
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "@jupyterlab-classic/lab-extension.*enabled.*ok" -
jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "jupyterlab_classic.*enabled" -
jupyter classic --version
jupyter classic --help
release:
if: startsWith(github.ref, 'refs/tags/')
needs: [install]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/download-artifact@v2
with:
name: dist ${{ github.run_number }}
path: ./tmp
- name: Copy to ./dist
run: |
mkdir dist/
cp ./tmp/jupyterlab-classic*.tar.gz ./tmp/jupyterlab_classic*.whl dist
ls dist
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
jlpm run lerna publish from-package --yes
- name: Get the current tag
id: current_tag
run: |
tag=`git describe --abbrev=0 --tags $(git rev-list --tags --max-count=1)`
echo "::set-output name=tag::${tag}"
- name: Get the previous tag
id: previous_tag
run: |
tag=`git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1)`
echo "::set-output name=tag::${tag}"
- name: Generate Changelog
env:
CHANGELOG_GITHUB_TOKEN: ${{ secrets.CHANGELOG_GITHUB_TOKEN }}
run: |
docker run --rm -v "$(pwd)":/usr/local/src/your-app \
-e CHANGELOG_GITHUB_TOKEN=${CHANGELOG_GITHUB_TOKEN} \
ferrarimarco/github-changelog-generator \
github_changelog_generator -u jtpio -p jupyterlab-classic --usernames-as-github-logins --no-issues --no-unreleased \
--since-tag ${{ steps.previous_tag.outputs.tag }} --header "" --pr-label "## Changes"
head -n -1 CHANGELOG.md > CHANGELOG
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.current_tag.outputs.tag }}
release_name: ${{ steps.current_tag.outputs.tag }}
body_path: CHANGELOG
# TODO: set to false?
draft: true
prerelease: false

@ -1,8 +1,37 @@
# Making a new release of JupyterLab Classic
# Releasing JupyterLab Classic
This process is still a bit manual and consists in running a couple of commands.
## Automated releases
Releases are automated using GitHub Actions. They are triggered when a new tag is pushed to the remote.
To cut a new release, run the following:
```bash
# checkout the main branch
git checkout main
# for a patch release
jlpm release:patch
# for a minor version bump
jlpm release:bump minor
# for a major version bump
jlpm release:bump major
This should normally be possible to automate the process at some point.
# push to the main branch
git push origin main --tags
```
We follow a similar bump strategy as in JupyterLab: https://github.com/jupyterlab/jupyterlab/blob/master/RELEASE.md#bump-version
The release workflow also creates a GitHub release with the new changes generated with [github-changelog-generator](https://github.com/github-changelog-generator/github-changelog-generator).
If you would still like to do the release manually instead, read below.
## Making a nanual new release of JupyterLab Classic
This process is still a bit manual and consists in running a couple of commands.
## Getting a clean environment

Loading…
Cancel
Save