Autoupdate #356
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
name: Autoupdate | |
on: | |
schedule: | |
- cron: 0 0 * * * | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x] | |
steps: | |
- name: Checkout code 🛎️ | |
uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} 🟢 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: https://registry.npmjs.org/ | |
- name: Install pnpm ⚙️ | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
run_install: false | |
- name: Environment log ⚙️ | |
id: env | |
run: | | |
node --version | |
pnpm --version | |
- name: Install dependencies 🔧 | |
run: | | |
pnpm install --frozen-lockfile | |
- name: Upgrade 🌠 | |
id: updates | |
run: | | |
PENDING=$(pnpm outdated --json|jq length) | |
echo "::set-output name=PENDING::$PENDING" | |
pnpm up --latest | |
DONE=$(pnpm outdated --json|jq length) | |
echo "::set-output name=DONE::$DONE" | |
- name: Build process 🧱 | |
if: steps.updates.outputs.PENDING != steps.updates.outputs.DONE | |
run: | | |
pnpm build | |
- name: Test 🧪 | |
if: steps.updates.outputs.PENDING != steps.updates.outputs.DONE | |
run: | | |
pnpm test | |
pnpm test:build | |
- name: Commit 🔒 | |
if: steps.updates.outputs.PENDING != steps.updates.outputs.DONE | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Ivan Zakharchanka" | |
git add --all | |
git commit -am "autoupdate" | |
npm version patch | |
- name: Push | |
if: steps.updates.outputs.PENDING != steps.updates.outputs.DONE | |
run: | | |
git push | |
git push --tags | |
- name: Publish 📚 | |
if: steps.updates.outputs.PENDING != steps.updates.outputs.DONE | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc | |
npm publish |