-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (51 loc) · 1.35 KB
/
update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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