diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml new file mode 100644 index 0000000..bdd4d29 --- /dev/null +++ b/.github/workflows/update-dependencies.yml @@ -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' || '' }} + +