-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
106 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: Update Dependencies | ||
|
||
on: | ||
schedule: | ||
# https://crontab.guru | ||
- cron: 0 0 1 * * | ||
|
||
workflow_dispatch: | ||
inputs: | ||
dryRun: | ||
description: 'Dry Run' | ||
default: true | ||
required: true | ||
type: boolean | ||
|
||
changeLog: | ||
description: 'Collect Change Log For Release' | ||
default: false | ||
required: true | ||
type: boolean | ||
|
||
push: | ||
description: 'Allow Git Push' | ||
default: false | ||
required: true | ||
type: boolean | ||
|
||
commit: | ||
description: 'Allow Git Commit' | ||
default: false | ||
required: true | ||
type: boolean | ||
|
||
all: | ||
description: 'Relate All Package' | ||
default: false | ||
required: true | ||
type: boolean | ||
|
||
version: | ||
description: 'Update Version(major.minor.patch)' | ||
default: 'patch' | ||
required: true | ||
type: choice | ||
options: | ||
- major | ||
- minor | ||
- patch | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup cache for Chromium binary | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/puppeteer/chrome | ||
key: chromium-${{ hashFiles('pnpm-lock.yaml') }} | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
run_install: false | ||
|
||
- name: Set node version to latest | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: latest | ||
cache: 'pnpm' | ||
|
||
- name: Checkout main | ||
run: git checkout main | ||
|
||
- name: Sanity check | ||
run: | | ||
echo branch `git branch --show-current`; | ||
echo node `node -v`; | ||
echo node `pnpm -v`; | ||
- name: Set git config | ||
run: | | ||
git config pull.rebase false | ||
git config --global user.email "update-workflow@*.*" | ||
git config --global user.name "Update Workflow" | ||
git remote set-url origin https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }} | ||
- name: Run init | ||
run: npm run init | ||
|
||
# schedule: npm run update -- --major --no-dry-run --no-push --no-commit | ||
- name: Run update | ||
run: >- | ||
npm run update -- | ||
--${{ inputs.version || 'major' }} | ||
${{ !contains(inputs.dryRun, 'true') && '--no-dry-run' || '' }} | ||
${{ !contains(inputs.push, 'true') && '--no-push' || '' }} | ||
${{ !contains(inputs.commit, 'true') && '--no-commit' || '' }} | ||
${{ contains(inputs.all, 'true') && '--all' || '' }} | ||
${{ contains(inputs.changeLog, 'false') && '--no-change-log' || '' }} | ||