-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (100 loc) · 4.18 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Check if a new version has been released by upstream
on:
schedule:
- cron: '0 2 * * *'
workflow_dispatch:
jobs:
update-snapcraft-yaml:
runs-on: ubuntu-latest
steps:
- name: install latest binary from official PPA
id: upstream
run: |
sudo apt-get install curl
curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash
sudo apt-get install speedtest
upstream_version=$(speedtest --version | head -n 1 | awk '{print $4}' | cut -c -5)
echo "version=$upstream_version" >> $GITHUB_OUTPUT
- name: show upstream version
run: |
upstream_version=${{ steps.upstream.outputs.version }}
if [ -z $upstream_version ]; then
exit 1
else
echo "Upstream version is $upstream_version"
fi
- name: Checkout this repo on master(amd64)
uses: actions/checkout@v4
with:
ref: master
- name: get snap current amd64 version
id: current_amd64
uses: mikefarah/yq@master
with:
cmd: yq '.version' 'snap/snapcraft.yaml'
- name: show snap current amd64 version
run: echo "Current version is ${{ steps.current_amd64.outputs.result }}"
- name: update to upstream's version number
id: update_amd64
if: steps.upstream.outputs.version != steps.current_amd64.outputs.result
uses: mikefarah/yq@master
with:
cmd: yq -i '.version = "${{ steps.upstream.outputs.version }}"' 'snap/snapcraft.yaml'
- name: Commit changes on amd64
if: steps.update_amd64.outcome == 'success'
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "update snapcraft.yaml to version ${{ steps.upstream.outputs.version }}"
git push
- name: Checkout this repo on arm64
uses: actions/checkout@v4
with:
ref: arm64
- name: get snap current arm64 version
id: current_arm64
uses: mikefarah/yq@master
with:
cmd: yq '.version' 'snap/snapcraft.yaml'
- name: show snap current arm64 version
run: echo "Current version is ${{ steps.current_arm64.outputs.result }}"
- name: update to upstream's version number
id: update_arm64
if: steps.upstream.outputs.version != steps.current_arm64.outputs.result
uses: mikefarah/yq@master
with:
cmd: yq -i '.version = "${{ steps.upstream.outputs.version }}"' 'snap/snapcraft.yaml'
- name: Commit changes on arm64
if: steps.update_arm64.outcome == 'success'
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "update snapcraft.yaml to version ${{ steps.upstream.outputs.version }}"
git push
- name: Checkout this repo on armhf
uses: actions/checkout@v4
with:
ref: armhf
- name: get snap current armhf version
id: current_armhf
uses: mikefarah/yq@master
with:
cmd: yq '.version' 'snap/snapcraft.yaml'
- name: show snap current armhf version
run: echo "Current version is ${{ steps.current_armhf.outputs.result }}"
- name: update to upstream's version number
id: update_armhf
if: steps.upstream.outputs.version != steps.current_armhf.outputs.result
uses: mikefarah/yq@master
with:
cmd: yq -i '.version = "${{ steps.upstream.outputs.version }}"' 'snap/snapcraft.yaml'
- name: Commit changes on armhf
if: steps.update_armhf.outcome == 'success'
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "update snapcraft.yaml to version ${{ steps.upstream.outputs.version }}"
git push