-
Notifications
You must be signed in to change notification settings - Fork 45
52 lines (42 loc) · 1.32 KB
/
update_cache.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
name: Update cache
on:
push:
branches:
- foo
# - develop
# schedule:
# - cron: '15 0 * * *'
jobs:
resources:
name: Update cache
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Set up NodeJS
uses: actions/setup-node@v1
- name: Set up Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.19
id: go
- name: Build binary
run: make all
- name: Create cache
run: export GITHUB_TOKEN=${{ secrets.GO_RELEASER_GITHUB_TOKEN }} && ./bin/binenv update -f -v -c2
- name: Format caches
run: jq '.' distributions/cache.json > dist.json && jq '.' ~/.cache/binenv/cache.json > new.json
- name: Compare caches
id: compare
run: |
echo "DIFF=$(diff dist.json new.json > /dev/null 2>&1; echo $?)" >> $GITHUB_ENV
- name: Copy cache
run: cat ~/.cache/binenv/cache.json | jq . > distributions/cache.json
if: ${{ env.DIFF != 0 }}
- name: Update cache
uses: test-room-7/action-update-file@v1
if: ${{ env.DIFF != 0 }}
with:
file-path: distributions/cache.json
commit-msg: automatic cache update
github-token: ${{ secrets.GITHUB_TOKEN }}