-
Notifications
You must be signed in to change notification settings - Fork 4
57 lines (51 loc) · 1.91 KB
/
update-k8s.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
name: update k8s
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
update:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Get latest kubernetes version
run: |
NEW_K8S_VERSION=$(
curl --silent -L https://api.github.com/repos/kubernetes/kubernetes/releases |
jq -r ".[] | .tag_name" |
grep -i -w -o 'v[0-9]*\.[0-9]*\.[0-9]*$' |
sed "s/v//" | sort --version-sort | tail -n 1
)
[[ -z "$NEW_K8S_VERSION" ]] && { echo "Failed to get latest kubernetes version" ; exit 1; }
echo "NEW_VERSION=$NEW_K8S_VERSION" >> "$GITHUB_ENV"
OLD_K8S_VERSION=$(
grep -i -w -E "kubernetesVersion.*[0-9].*" build.sbt |
sed -E "s/.*kubernetesVersion\s*:=\s*\"(.+)\"/\1/"
)
[[ -z "$OLD_K8S_VERSION" ]] && { echo "Failed to get the kubernetes version of current build" ; exit 1; }
echo "OLD_VERSION=$OLD_K8S_VERSION" >> "$GITHUB_ENV"
-
name: Update to the latest kubernetes version
run: |
sed -i -E "s/(kubernetesVersion\s*:=\s*).*\"/\1\"${{ env.NEW_VERSION }}\"/" build.sbt
sed -i "s/${{ env.OLD_VERSION }}/${{ env.NEW_VERSION }}/g" README.md
-
name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.UPDATE_TOKEN }}
commit-message: Update kubernetes
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: updates/kubernetes
delete-branch: true
title: 'Update kubernetes version'
body: |
Updated kubernetes from ${{ env.OLD_VERSION }} to ${{ env.NEW_VERSION }}
labels: |
dependencies
automated