Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update version sync workflow #689

Merged
merged 1 commit into from
Aug 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 30 additions & 20 deletions .github/workflows/sync_lab_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,43 +25,53 @@ jobs:
run: |
python -m pip install tbump

- name: Check for new releases
shell: bash
run: |
set -eux
export LATEST=$(python scripts/get_latest_lab_version.py)
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@v3
with:
node-version: '14.x'

- name: Install npm dependencies
if: env.update_available == 'true'
run: |
npm install --global yarn
yarn install

- name: Check for new releases
shell: bash
run: |
set -eux
export LATEST=$(python scripts/get_latest_lab_version.py)
echo "latest=${LATEST}" >> $GITHUB_ENV
tbump --only-patch ${LATEST}-1 --non-interactive
- name: Install conda
if: env.update_available == 'true'
uses: s-weigand/setup-conda@v1
- run: conda install -c conda-forge conda conda-lock -y

- name: Create a PR if needed
if: env.update_available == 'true'
shell: bash
env:
GITHUB_USER: ${{ secrets.GITHUB_USER }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eux
# if resulted in any change:
yarn update_conda_lock
export LATEST=${{ env.latest }}
if [[ ! -z "$(git status --porcelain package.json)" ]]; then
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]'
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 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.".
fi
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.".

Loading