Skip to content

Commit

Permalink
workflow: add update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
deot committed Jan 9, 2024
1 parent bafa63d commit 9b8e256
Showing 1 changed file with 106 additions and 0 deletions.
106 changes: 106 additions & 0 deletions .github/workflows/update-dependencies.yml
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' || '' }}

0 comments on commit 9b8e256

Please sign in to comment.