Skip to content

Check for new JupyterLab releases #1131

Check for new JupyterLab releases

Check for new JupyterLab releases #1131

name: Check for new JupyterLab releases
on:
schedule:
- cron: 30 17 * * *
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
check_for_lab_updates:
runs-on: macos-latest
defaults:
run:
# needed for conda to work
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
- name: Install hub
run: |
brew install hub
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install Python dependencies
run: |
python -m pip install tbump
- name: 'Get latest JupyterLab version'
uses: actions/github-script@v7
id: get-latest-jupyterlab-version
with:
github-token: ${{ secrets.JLAB_APP_TOKEN }}
script: |
const releases = await github.rest.repos.listReleases({
owner: "jupyterlab",
repo: "jupyterlab"
})
const latestRelease = releases.data.find(release => release.tag_name.startsWith('v') && !(release.draft || release.prerelease))
return latestRelease ? latestRelease.tag_name.substring(1) : ''
result-encoding: string
- name: Check for new releases
shell: bash
run: |
set -eux
export LATEST=${{ steps.get-latest-jupyterlab-version.outputs.result }}
echo "latest=${LATEST}" >> $GITHUB_ENV
tbump --only-patch ${LATEST}-1 --non-interactive
if [[ ! -z "$(git status --porcelain package.json)" ]]; then
echo "update_available=true" >> $GITHUB_ENV
fi
- name: Install Node
if: env.update_available == 'true'
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install npm dependencies
if: env.update_available == 'true'
run: |
npm install --global yarn
yarn install
- uses: conda-incubator/setup-miniconda@v3
if: env.update_available == 'true'
with:
auto-update-conda: true
auto-activate-base: true
activate-environment: ""
channels: conda-forge
- name: Install conda dependencies
if: env.update_available == 'true'
run: conda install -c conda-forge conda conda-lock -y
- name: Update conda lock files
if: env.update_available == 'true'
run: yarn update_conda_lock
- name: Update binary sign list osx-64
if: env.update_available == 'true'
run: |
yarn clean_env_installer && conda-lock install --no-validate-platform --prefix ./env_installer/jlab_server ./env_installer/conda-osx-64.lock
yarn update_binary_sign_list --platform osx-64
- name: Update binary sign list osx-arm64
if: env.update_available == 'true'
run: |
yarn clean_env_installer && conda-lock install --no-validate-platform --prefix ./env_installer/jlab_server ./env_installer/conda-osx-arm64.lock
yarn update_binary_sign_list --platform osx-arm64
- name: Create a PR for the new version
if: env.update_available == 'true'
shell: bash
env:
GITHUB_USER: ${{ secrets.GITHUB_USER }}
GITHUB_TOKEN: ${{ secrets.JLAB_APP_TOKEN }}
run: |
set -eux
export LATEST=${{ env.latest }}
export BRANCH_NAME=update-to-v${LATEST}
# this will fail if the branch already exists which means we won't have duplicate PRs
git checkout -b "${BRANCH_NAME}"
git config user.name "JupyterLab Desktop Bot"
git config user.email '[email protected]'
git commit . -m "Update to JupyterLab v${LATEST}"
git push --set-upstream origin "${BRANCH_NAME}"
hub pull-request -m "Update to JupyterLab v${LATEST}" \
-m "New JupyterLab release [v${LATEST}](https://github.com/jupyterlab/jupyterlab/releases/tag/v${LATEST}) is available. Please review the lock file carefully.".