-
Notifications
You must be signed in to change notification settings - Fork 4
66 lines (57 loc) · 1.95 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
56
57
58
59
60
61
62
63
64
65
66
name: Update non-npm dependencies
on:
schedule:
- cron: '0 0 * * *'
jobs:
update:
runs-on: ubuntu-latest
strategy:
matrix:
dependency: ['swipl', 'emsdk', 'zlib', 'pcre2']
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
- name: Use Node.js
uses: actions/setup-node@v4
with:
# Consider using lts
node-version: 20.x
- name: Commit latest release version
run: |
npm ci
pth=".config.${{ matrix.dependency }}.version"
before=$(cat ./package.json | jq "$pth")
npm run "update:dep:${{ matrix.dependency }}"
current=$(cat ./package.json | jq "$pth")
readarray -d . -t before <<<"${before:1:-1}"
readarray -d . -t after <<<"${current:1:-1}"
if [ ! ${before[0]} == ${after[0]} ]
then
version="BREAKING CHANGE"
branchHead="breaking"
elif [ ! ${before[1]} == ${after[1]} ]
then
version="feat"
branchHead="feat"
elif [ ! ${before[2]} == ${after[2]} ]
then
version="fix"
branchHead="fix"
fi
# The name of the new branch if we need to create one
branch=$branchHead/update-${{ matrix.dependency }}-v${current:1:-1}
msg="$version: update to ${{ matrix.dependency }} v${current:1:-1}"
if [ $branchHead ]; then
git config --global user.name 'Jesse Wright'
git config --global user.email '63333554+jeswr@users.noreply.github.com'
git checkout -b $branch
git commit -am "$msg"
git push --set-upstream origin $branch
gh pr create -t "$msg" -b "$msg"
if [ ! $branchHead == "breaking" ]; then
gh pr merge $branch --auto --squash
fi
fi
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}