Adopt the Jupyter Releaser

This commit is contained in:
Jeremy Tuloup 2021-09-07 09:43:46 +02:00
parent 2afb52387f
commit c851810c6f
2 changed files with 0 additions and 232 deletions

View File

@ -18,19 +18,7 @@ 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 20,146p .github/workflows/build.yml > build
sed -n 20,146p .github/workflows/release.yml > release
diff build release
test:
needs: [integrity]
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -65,7 +53,6 @@ jobs:
jlpm run test
build:
needs: [integrity]
runs-on: ubuntu-latest
steps:
- name: Checkout

View File

@ -1,219 +0,0 @@
name: Release
on:
push:
tags:
- '*'
permissions:
contents:
write
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 20,146p .github/workflows/build.yml > build
sed -n 20,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@v2
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~=0.10
- name: Install the package
run: |
python -m pip install .
jupyter labextension list 2>&1 | grep -ie "@retrolab/lab-extension.*enabled.*ok" -
jupyter server extension list 2>&1 | grep -ie "retrolab.*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@v2
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~=0.10 "jupyterlab>=3,<4" build
- name: Build pypi distributions
run: |
python -m build
- name: Build npm distributions
run: |
mkdir pkgs
jlpm lerna exec -- npm pack
cp packages/*/*.tgz pkgs
- name: Build checksum file
run: |
cd dist
sha256sum * | tee SHA256SUMS
cd ../pkgs
sha256sum * | tee SHA256SUMS
- name: Upload distributions
uses: actions/upload-artifact@v2
with:
name: dist ${{ github.run_number }}
path: ./dist
- name: Upload distributions
uses: actions/upload-artifact@v2
with:
name: pkgs ${{ github.run_number }}
path: ./pkgs
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: 'retrolab*.tar.gz'
- python: '3.9'
dist: 'retrolab*.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 "@retrolab/lab-extension.*enabled.*ok" -
jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "retrolab.*enabled" -
jupyter retro --version
jupyter retro --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: ./dist
- name: Cleanup dist
run: |
rm dist/SHA256SUMS
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
- name: Install dependencies
run: |
python -m pip install -U jupyterlab~=3.0 jupyter_packaging~=0.10 pip
jlpm
jlpm run build
- uses: actions/download-artifact@v2
with:
name: pkgs ${{ github.run_number }}
path: ./pkgs
- uses: actions/setup-node@v2
with:
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- name: Publish to npm
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
# do not publish the metapackage
rm pkgs/retrolab-metapackage*
jlpm config set registry https://registry.npmjs.org
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
cp ~/.npmrc .npmrc
jlpm release:npm --dist ./pkgs
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
# TODO: set to false?
draft: true
prerelease: ${{ contains(github.ref, 'a') || contains(github.ref, 'b') || contains(github.ref, 'rc') }}