Check for new JupyterLab releases #558
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
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: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install tbump | |
- name: Install Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '14.x' | |
- name: Install npm dependencies | |
run: | | |
npm install --global yarn | |
yarn install | |
- name: Check for new Jupyterlab releases | |
shell: bash | |
run: | | |
set -eux | |
export JUPYTER_LATEST=$(python scripts/get_latest_lab_version.py) | |
echo "jupyter_latest=${JUPYTER_LATEST}" >> $GITHUB_ENV | |
yarn set_jupyterlab_version ${JUPYTER_LATEST} | |
- name: Check for new Neurodesk releases | |
shell: bash | |
run: | | |
set -eux | |
export NEURODESK_LATEST=$(python scripts/get_neurodesk_version.py) | |
echo "neurodesk_latest=${NEURODESK_LATEST}" >> $GITHUB_ENV | |
yarn set_neurodesk_version ${NEURODESK_LATEST} | |
- name: Create a PR if needed | |
shell: bash | |
env: | |
GITHUB_USER: ${{ secrets.GITHUB_USER }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
set -eux | |
# if resulted in any change: | |
export JUPYTER_LATEST=${{ env.jupyter_latest }} | |
if [[ ! -z "$(git status --porcelain package.json)" ]]; then | |
export BRANCH_NAME=update-jupyter-to-v${JUPYTER_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 'jupyterlab-bot@users.noreply.github.com' | |
git commit . -m "Update to JupyterLab v${JUPYTER_LATEST}" | |
git push --set-upstream origin "${BRANCH_NAME}" | |
hub pull-request -m "Update to JupyterLab v${JUPYTER_LATEST}" \ | |
-m "New JupyterLab release [v${JUPYTER_LATEST}](https://github.com/jupyterlab/jupyterlab/releases/tag/v${JUPYTER_LATEST}) is available. Please review the lock file carefully.". | |
fi | |
export NEURODESK_LATEST=${{ env.neurodesk_latest }} | |
if [[ ! -z "$(git status --porcelain neurodesktop.toml)" ]]; then | |
export BRANCH_NAME=update-neurodesk-to-v${NEURODESK_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 "Neurodesk Desktop Bot" | |
git config user.email 'neurodesk-bot@users.noreply.github.com' | |
git commit . -m "Update to Neurodesk v${NEURODESK_LATEST}" | |
git push --set-upstream origin "${BRANCH_NAME}" | |
sudo apt install hub | |
hub pull-request -m "Update to Neurodesk v${NEURODESK_LATEST}" \ | |
-m "New Neurodesk release [v${NEURODESK_LATEST}](https://github.com/NeuroDesk/neurodesk.github.io/blob/main/data/neurodesktop.toml) is available. Please review the lock file carefully.". | |
fi | |