mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 20:08:37 +00:00
chore: add timed update workflow (#1214)
This commit is contained in:
71
.github/workflows/update-block-suite.yml
vendored
Normal file
71
.github/workflows/update-block-suite.yml
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
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:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Use pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 7
|
||||
|
||||
- name: Use Node.js 18
|
||||
# https://github.com/actions/setup-node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '18.X'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- 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 }}
|
||||
Reference in New Issue
Block a user