generated from jeswr/template-typescript
-
Notifications
You must be signed in to change notification settings - Fork 5
56 lines (48 loc) · 1.82 KB
/
update-eye.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
name: Update to use the latest version of eye
on:
schedule:
- cron: '0 */2 * * *'
jobs:
get-version:
runs-on: ubuntu-latest
strategy:
matrix:
dep: [eye, lingua]
steps:
- uses: actions/checkout@v4
- name: Commit latest release version
run: |
npm ci
# Get version of EYE before any updates are run
before=$(cat ./package.json | jq '.config."${{ matrix.dep }}".name')
npm run ${{ matrix.dep }}:update
# Version of EYE after getting updates
current=$(cat ./package.json | jq '.config."${{ matrix.dep }}".name')
readarray -d . -t before <<<"${before:2:-1}"
readarray -d . -t after <<<"${current:2:-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.dep }}-${current:1:-1}
msg="$version: update to ${{ matrix.dep }} ${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" -n
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 }}