-
Notifications
You must be signed in to change notification settings - Fork 25
218 lines (213 loc) · 11.3 KB
/
check-for-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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
name: Check for Update
on:
push:
branches:
- master
jobs:
minikube-version:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: check minikube version
working-directory: ./.github/workflows
run: |
echo "SOURCE_QUARKUS_VERSION=$(grep "minikube-version" minikube-quarkus-ci.yml | awk '{print $2}')" >> $GITHUB_ENV
echo "SOURCE_YAML_VERSION=$(grep "minikube-version" minikube-yaml-ci.yml | awk '{print $2}')" >> $GITHUB_ENV
echo "SOURCE_STRESS_VERSION=$(grep "minikube-version" minikube-stress-ci.yml | awk '{print $2}')" >> $GITHUB_ENV
echo "SOURCE_SECURITY_VERSION=$(grep "minikube-version" minikube-security-ci.yml | awk '{print $2}')" >> $GITHUB_ENV
echo "SOURCE_DOC_VERSION=$(grep "Minikube Version" ../../README.md | cut -d '-' -f 2)" >> $GITHUB_ENV
echo "TARGET_MINIKUBE_VERSION=$(curl -s https://api.github.com/repos/kubernetes/minikube/releases | jq -r '.[].tag_name' | grep -v '-' | sort -t'.' -k2,2n | tail -n 1 | tr -d 'v')" >> $GITHUB_ENV
- name: check current diff
run: |
echo SOURCE_QUARKUS_VERSION: ${SOURCE_QUARKUS_VERSION}
echo SOURCE_YAML_VERSION: ${SOURCE_YAML_VERSION}
echo SOURCE_STRESS_VERSION: ${SOURCE_STRESS_VERSION}
echo SOURCE_SECURITY_VERSION: ${SOURCE_SECURITY_VERSION}
echo SOURCE_DOC_VERSION: ${SOURCE_DOC_VERSION}
echo TARGET_MINIKUBE_VERSION: ${TARGET_MINIKUBE_VERSION}
test "${TARGET_MINIKUBE_VERSION}" != ""
if [[ ${SOURCE_QUARKUS_VERSION} != ${TARGET_MINIKUBE_VERSION} ]] || [[ ${SOURCE_YAML_VERSION} != ${TARGET_MINIKUBE_VERSION} ]] || [[ ${SOURCE_STRESS_VERSION} != ${TARGET_MINIKUBE_VERSION} ]] || [[ ${SOURCE_SECURITY_VERSION} != ${TARGET_MINIKUBE_VERSION} ]] || [[ ${SOURCE_DOC_VERSION} != ${TARGET_MINIKUBE_VERSION} ]]; then
echo "UNMATCH_VERSION=true" >> $GITHUB_ENV
echo "Unmatched."
fi
- name: Set whether minikube branch is already existing to GITHUB_ENV
run: |
branch_is_existing=$(
git fetch origin actions/check-for-update-minikube &&
echo true ||
echo false
)
echo "BRANCH_IS_EXISTING=${branch_is_existing}" >> $GITHUB_ENV
- name: check env
run: |
echo UNMATCH_VERSION: ${UNMATCH_VERSION}
echo BRANCH_IS_EXISTING: ${BRANCH_IS_EXISTING}
- name: update minikube quarkus version
if: env.UNMATCH_VERSION == 'true' && env.BRANCH_IS_EXISTING == 'false'
working-directory: ./.github/workflows
run: |
sed -i -e "s/$SOURCE_QUARKUS_VERSION/$TARGET_MINIKUBE_VERSION/g" minikube-quarkus-ci.yml
sed -i -e "s/$SOURCE_YAML_VERSION/$TARGET_MINIKUBE_VERSION/g" minikube-yaml-ci.yml
sed -i -e "s/$SOURCE_STRESS_VERSION/$TARGET_MINIKUBE_VERSION/g" minikube-stress-ci.yml
sed -i -e "s/$SOURCE_SECURITY_VERSION/$TARGET_MINIKUBE_VERSION/g" minikube-security-ci.yml
sed -i -e "s/$SOURCE_DOC_VERSION/$TARGET_MINIKUBE_VERSION/g" ../../README.md
- name: Add, commit, push, and create PR
if: env.UNMATCH_VERSION == 'true' && env.BRANCH_IS_EXISTING == 'false'
uses: peter-evans/[email protected]
with:
token: ${{ secrets.PAT_GITHUB_ACTION_WORKFLOW }}
branch: actions/check-for-update-minikube
title: check-for-update-minikube automated change
commit-message: check-for-update-minikube automated change
labels: cicd
delete-branch: true
kubernetes-version:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: check kubernetes version
working-directory: ./.github/workflows
run: |
echo "SOURCE_QUARKUS_VERSION=$(grep "kubernetes-version" minikube-quarkus-ci.yml | awk '{print $2}')" >> $GITHUB_ENV
echo "SOURCE_YAML_VERSION=$(grep "kubernetes-version" minikube-yaml-ci.yml | awk '{print $2}')" >> $GITHUB_ENV
echo "SOURCE_STRESS_VERSION=$(grep "kubernetes-version" minikube-stress-ci.yml | awk '{print $2}')" >> $GITHUB_ENV
echo "SOURCE_SECURITY_VERSION=$(grep "kubernetes-version" minikube-security-ci.yml | awk '{print $2}')" >> $GITHUB_ENV
echo "SOURCE_DOC_VERSION=$(grep "Kubernetes Version" ../../README.md | cut -d '-' -f 2)" >> $GITHUB_ENV
echo "TARGET_KUBERNETES_VERSION=$(curl -s https://api.github.com/repos/kubernetes/kubernetes/releases | jq -r '.[].tag_name' | grep -v '-' | sort -t'.' -k2,2n | tail -n 1 | tr -d 'v')" >> $GITHUB_ENV
- name: check current diff
run: |
echo SOURCE_QUARKUS_VERSION: ${SOURCE_QUARKUS_VERSION}
echo SOURCE_YAML_VERSION: ${SOURCE_YAML_VERSION}
echo SOURCE_STRESS_VERSION: ${SOURCE_STRESS_VERSION}
echo SOURCE_SECURITY_VERSION: ${SOURCE_SECURITY_VERSION}
echo SOURCE_DOC_VERSION: ${SOURCE_DOC_VERSION}
echo TARGET_KUBERNETES_VERSION: ${TARGET_KUBERNETES_VERSION}
test "${TARGET_KUBERNETES_VERSION}" != ""
if [[ ${SOURCE_QUARKUS_VERSION} != ${TARGET_KUBERNETES_VERSION} ]] || [[ ${SOURCE_YAML_VERSION} != ${TARGET_KUBERNETES_VERSION} ]] || [[ ${SOURCE_STRESS_VERSION} != ${TARGET_KUBERNETES_VERSION} ]] || [[ ${SOURCE_SECURITY_VERSION} != ${TARGET_KUBERNETES_VERSION} ]] || [[ ${SOURCE_DOC_VERSION} != ${TARGET_KUBERNETES_VERSION} ]]; then
echo "UNMATCH_VERSION=true" >> $GITHUB_ENV
echo "Unmatched."
fi
- name: Set whether kubernetes branch is already existing to GITHUB_ENV
run: |
branch_is_existing=$(
git fetch origin actions/check-for-update-kubernetes &&
echo true ||
echo false
)
echo "BRANCH_IS_EXISTING=${branch_is_existing}" >> $GITHUB_ENV
- name: check env
run: |
echo UNMATCH_VERSION: ${UNMATCH_VERSION}
echo BRANCH_IS_EXISTING: ${BRANCH_IS_EXISTING}
- name: update kubernetes version
if: env.UNMATCH_VERSION == 'true' && env.BRANCH_IS_EXISTING == 'false'
working-directory: ./.github/workflows
run: |
sed -i -e "s/$SOURCE_QUARKUS_VERSION/$TARGET_KUBERNETES_VERSION/g" minikube-quarkus-ci.yml
sed -i -e "s/$SOURCE_YAML_VERSION/$TARGET_KUBERNETES_VERSION/g" minikube-yaml-ci.yml
sed -i -e "s/$SOURCE_STRESS_VERSION/$TARGET_KUBERNETES_VERSION/g" minikube-stress-ci.yml
sed -i -e "s/$SOURCE_SECURITY_VERSION/$TARGET_KUBERNETES_VERSION/g" minikube-security-ci.yml
sed -i -e "s/$SOURCE_DOC_VERSION/$TARGET_KUBERNETES_VERSION/g" ../../README.md
- name: Add, commit, push, and create PR
if: env.UNMATCH_VERSION == 'true' && env.BRANCH_IS_EXISTING == 'false'
uses: peter-evans/[email protected]
with:
token: ${{ secrets.PAT_GITHUB_ACTION_WORKFLOW }}
branch: actions/check-for-update-kubernetes
title: check-for-update-kubernetes automated change
commit-message: check-for-update-kubernetes automated change
labels: cicd
delete-branch: true
chaos-mesh-version:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: check current chaos-mesh version
working-directory: ./.github/workflows
run: |
echo "SOURCE_VERSION=$(grep CHAOS_MESH_VERSION kind-chaos-mesh-ci.yml | awk '{print $2}')" >> $GITHUB_ENV
echo "SOURCE_DOC_VERSION=$(grep "kind Version" ../../README.md | cut -d '-' -f 2)" >> $GITHUB_ENV
- name: check latest tag chaos mesh version
run: echo "TARGET_VERSION=$(curl -s https://api.github.com/repos/chaos-mesh/chaos-mesh/releases | jq -r '.[].tag_name' | grep -v '-' | sort -t'.' -k2,2n | tail -n 1 | tr -d 'v')" >> $GITHUB_ENV
- name: check diff chaos mesh
run: |
echo SOURCE_VERSION: ${SOURCE_VERSION}
echo SOURCE_DOC_VERSION: ${SOURCE_DOC_VERSION}
echo TARGET_VERSION: ${TARGET_VERSION}
test "${TARGET_VERSION}" != ""
if [[ ${SOURCE_VERSION} != ${TARGET_VERSION} ]] || [[ ${SOURCE_DOC_VERSION} != ${TARGET_VERSION} ]]; then
echo "UNMATCH_VERSION=true" >> $GITHUB_ENV
echo "Unmatched."
fi
- name: Set whether chaos-mesh branch is already existing to GITHUB_ENV
run: |
branch_is_existing=$(
git fetch origin actions/check-for-update-chaos-mesh &&
echo true ||
echo false
)
echo "BRANCH_IS_EXISTING=${branch_is_existing}" >> $GITHUB_ENV
- name: check env
run: |
echo UNMATCH_VERSION: ${UNMATCH_VERSION}
echo BRANCH_IS_EXISTING: ${BRANCH_IS_EXISTING}
- name: update chaos-mesh version
if: env.UNMATCH_VERSION == 'true' && env.BRANCH_IS_EXISTING == 'false'
working-directory: ./.github/workflows
run: |
sed -i -e "s/$SOURCE_VERSION/$TARGET_VERSION/g" kind-chaos-mesh-ci.yml
sed -i -e "s/$SOURCE_DOC_VERSION/$TARGET_VERSION/g" ../../README.md
- name: Add, commit, push, and create PR
if: env.UNMATCH_VERSION == 'true' && env.BRANCH_IS_EXISTING == 'false'
uses: peter-evans/[email protected]
with:
token: ${{ secrets.PAT_GITHUB_ACTION_WORKFLOW }}
branch: actions/check-for-update-chaos-mesh
title: check-for-update-chaos-mesh automated change
commit-message: check-for-update-chaos-mesh automated change
labels: cicd
delete-branch: true
quarkus-version:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: check current quarkus version
run: |
echo "SOURCE_VERSION=$(grep "Quarkus Version" README.md | cut -d '-' -f 2)" >> $GITHUB_ENV
- name: check latest tag quarkus version
run: echo "TARGET_VERSION=$(grep /quarkus.platform.version application/parent-pom/pom.xml | cut -d '>' -f 2 | cut -d '.' -f 1-3)" >> $GITHUB_ENV
- name: check diff quarkus mesh
run: |
echo SOURCE_VERSION: ${SOURCE_VERSION}
echo TARGET_VERSION: ${TARGET_VERSION}
test "${TARGET_VERSION}" != ""
if [[ ${SOURCE_VERSION} != ${TARGET_VERSION} ]]; then
echo "UNMATCH_VERSION=true" >> $GITHUB_ENV
echo "Unmatched."
fi
- name: Set whether quarkus branch is already existing to GITHUB_ENV
run: |
branch_is_existing=$(
git fetch origin actions/check-for-update-quarkus &&
echo true ||
echo false
)
echo "BRANCH_IS_EXISTING=${branch_is_existing}" >> $GITHUB_ENV
- name: check env
run: |
echo UNMATCH_VERSION: ${UNMATCH_VERSION}
echo BRANCH_IS_EXISTING: ${BRANCH_IS_EXISTING}
- name: update quarkus version
if: env.UNMATCH_VERSION == 'true' && env.BRANCH_IS_EXISTING == 'false'
run: |
sed -i -e "s/$SOURCE_VERSION/$TARGET_VERSION/g" README.md
- name: Add, commit, push, and create PR
if: env.UNMATCH_VERSION == 'true' && env.BRANCH_IS_EXISTING == 'false'
uses: peter-evans/[email protected]
with:
token: ${{ secrets.PAT_GITHUB_ACTION_WORKFLOW }}
branch: actions/check-for-update-quarkus
title: check-for-update-quarkus automated change
commit-message: check-for-update-quarkus automated change
labels: cicd
delete-branch: true