-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (50 loc) · 1.63 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
55
name: Auto-Update
on:
workflow_dispatch:
schedule:
- cron: "0 0 */3 * *"
jobs:
update:
name: Update
outputs:
publish: ${{ steps.commit.outputs.publish }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "yarn"
- name: Update data
run: |
yarn install --immutable --immutable-cache --check-cache
yarn update
- name: Commit changes
id: commit
run: |
if [[ `git status --porcelain` ]]; then
echo "Committing changes."
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "Stations Auto-Update (`date '+%Y.%m.%d %H:%M:%S'`)" -a || true
git push
echo "publish=true" >> $GITHUB_OUTPUT
else
echo "No changes."
echo "publish=false" >> $GITHUB_OUTPUT
fi
- name: Discord message
uses: sarisia/actions-status-discord@v1
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
description: ${{ steps.commit.outputs.publish == 'true' && 'Publish started' || 'Publish skipped' }}
color: ${{ steps.commit.outputs.publish == 'true' && '0x009800' || '0x1e1f22' }}
publish:
name: Publish
needs: update
if: needs.update.outputs.publish == 'true' || github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/publish.yml