Autoupdate #47
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: [18.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: Environment log ⚙️ | |
id: env | |
run: | | |
node --version | |
yarn --version | |
- name: Install dependencies 🔧 | |
run: | | |
yarn install --frozen-lockfile | |
- name: Upgrade 🌠 | |
id: updates | |
run: | | |
PENDING=$(yarn outdated --json|tail -1|jq '.data.body'|jq length) | |
echo "::set-output name=PENDING::$PENDING" | |
yarn upgrade | |
DONE=$(yarn outdated --json|tail -1|jq '.data.body'|jq length) | |
echo "::set-output name=DONE::$DONE" | |
- name: Build process 🧱 | |
if: steps.updates.outputs.PENDING != steps.updates.outputs.DONE | |
run: | | |
yarn build | |
- name: Test 🧪 | |
if: steps.updates.outputs.PENDING != steps.updates.outputs.DONE | |
run: | | |
yarn test | |
yarn 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 |