AFFiNE/.github/workflows/update-block-suite.yml

62 lines
2.1 KiB
YAML

name: Update block-suite version
on:
schedule:
# At 02:00 UTC
- cron: '0 2 * * *'
workflow_dispatch:
# Cancels all previous workflow runs for pull requests that have not completed.
# See https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
# The concurrency group contains the workflow name and the branch name for
# pull requests or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- run: pnpm i
- name: Get old version
id: old-version
run: |
PACKAGE_VERSION=$(cat apps/web/package.json | jq '.dependencies["@blocksuite/editor"]' | tr -d '"')
echo "old-version=${PACKAGE_VERSION}" >> $GITHUB_OUTPUT
- name: Update block-suite version
run: pnpm update:core
- name: Get new version
id: new-version
run: |
PACKAGE_VERSION=$(cat apps/web/package.json | jq '.dependencies["@blocksuite/editor"]' | tr -d '"')
echo "new-version=${PACKAGE_VERSION}" >> $GITHUB_OUTPUT
# https://github.com/actions-js/push
- name: Commit push
uses: actions-js/push@master
with:
github_token: '${{ secrets.GITHUB_TOKEN }}'
message: 'chore: bump blocksuite from ${{ steps.old-version.outputs.old-version }} to ${{ steps.new-version.outputs.new-version }}'
force: true
branch: refs/heads/bot/bump-core
# see https://github.com/repo-sync/pull-request
- name: Create Pull Request
uses: repo-sync/pull-request@v2
with:
source_branch: bot/bump-core
pr_title: 'Bump blocksuite to ${{ steps.new-version.outputs.new-version }}'
pr_body: 'Please carefully check the editor functionality before merging the PR.'
github_token: ${{ secrets.GITHUB_TOKEN }}