-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (80 loc) · 2.28 KB
/
auto-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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Auto Update
on:
schedule:
- cron: '0 0 * * 1' # Runs at 12:00 AM UTC every Monday
workflow_dispatch:
inputs:
force:
description: Force Update
default: '0'
dry:
description: Dry Run
default: '0'
bump:
type: choice
description: Bump Version
options:
- patch
- minor
- major
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: git-actions/set-user@v1
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20.x
registry-url: https://registry.npmjs.org/
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: npm ci
- id: update
run: |
force="${{ github.event.inputs.force }}"
dry="${{ github.event.inputs.dry }}"
bump="${{ github.event.inputs.bump }}"
if [ "$bump" = "" ]; then
bump="patch"
fi
# Check for Updates
status=0
npm run check || status=$?
if [ $status -eq 0 ] || [ $status -eq 4 ]; then
if [ "$force" != "1" ]; then
echo "::set-output name=trigger_release::no"
exit 0 # exit if there are no changes or if icons are only removed
fi
fi
if [ $status -ge 4 ]; then
bump="minor" # icons are removed from metadata API
fi
# Download new metadata
npm run download:metadata
git add .
# Bump Version
npm version "$bump" -m "build: auto update to v%s" --force
# Push
if [ "$dry" = "1" ]; then
echo "::set-output name=trigger_release::no"
exit 0
fi
git push --follow-tags
echo "::set-output name=trigger_release::yes"
outputs:
trigger_release: ${{ steps.update.outputs.trigger_release }}
conditional-workflow:
runs-on: ubuntu-latest
needs: update
if: needs.update.outputs.trigger_release == 'yes'
steps:
- name: Trigger Release
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Release