Update #721
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: Update | |
on: | |
schedule: | |
- cron: '33 1 * * *' # Runs at 01:33 UTC every day | |
workflow_dispatch: | |
inputs: | |
force: | |
description: Force Update | |
default: '0' | |
dry: | |
description: Dry Run | |
default: '1' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ssh-key: ${{ secrets.DEPLOY_KEY }} | |
- uses: git-actions/set-user@v1 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
registry-url: https://registry.npmjs.org | |
always-auth: true | |
- run: npm ci | |
- name: Update | |
run: | | |
force="${{ github.event.inputs.force }}" | |
dry="${{ github.event.inputs.dry }}" | |
status=0 | |
npm run build || status=$? | |
if [ $status -gt 0 ]; then | |
if [ $status -ne 69 ]; then | |
exit $status | |
fi | |
if [ "$force" != "1" ]; then | |
exit 0 | |
fi | |
fi | |
git add --all | |
git diff --name-only --cached | |
git commit -m '🔨' || [ "$force" = "1" ] || exit 1 | |
# Push | |
if [ "$dry" = "1" ]; then | |
exit 0 | |
fi | |
npm run pub | |
git push --follow-tags |