forked from kubearmor/KubeArmor
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (66 loc) · 2.96 KB
/
ci-stable-release.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
name: ci-stable-release
on:
push:
branches: [main]
paths:
- "STABLE-RELEASE"
# Declare default permissions as read only.
permissions: read-all
jobs:
push-stable-version:
name: Create KubeArmor stable release
if: github.repository == 'kubearmor/kubearmor'
runs-on: ubuntu-20.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- name: Install regctl
run: |
curl -L https://github.com/regclient/regclient/releases/latest/download/regctl-linux-amd64 >regctl
chmod 755 regctl
mv regctl /usr/local/bin
- name: Check install
run: regctl version
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_AUTHTOK }}
- name: Generate the stable version of KubeArmor in Docker Hub
run: |
STABLE_VERSION=`cat STABLE-RELEASE`
regctl image copy kubearmor/kubearmor:$STABLE_VERSION kubearmor/kubearmor:stable --digest-tags
regctl image copy kubearmor/kubearmor-init:$STABLE_VERSION kubearmor/kubearmor-init:stable --digest-tags
regctl image copy kubearmor/kubearmor-ubi:$STABLE_VERSION kubearmor/kubearmor-ubi:stable --digest-tags
regctl image copy kubearmor/kubearmor-controller:$STABLE_VERSION kubearmor/kubearmor-controller:stable --digest-tags
regctl image copy kubearmor/kubearmor-operator:$STABLE_VERSION kubearmor/kubearmor-operator:stable --digest-tags
regctl image copy kubearmor/kubearmor-snitch:$STABLE_VERSION kubearmor/kubearmor-snitch:stable --digest-tags
update-helm-chart:
name: Update KubeArmor Helm chart version
if: github.repository == 'kubearmor/kubearmor'
runs-on: ubuntu-20.04
timeout-minutes: 20
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v3
- name: Update Chart.yaml
id: update
run: |
STABLE_VERSION=`cat STABLE-RELEASE`
sed -i -e "s/appVersion:.*/appVersion: $STABLE_VERSION/g" deployments/helm/*/Chart.yaml
sed -i -e "s/version:.*/version: $STABLE_VERSION/g" deployments/helm/*/Chart.yaml
echo "STABLE_VERSION=$STABLE_VERSION" >> $GITHUB_OUTPUT
- name: Create PR to update Helm chart version in KubeArmor repo
uses: peter-evans/create-pull-request@v5
with:
branch: update-helm-${{ steps.update.outputs.STABLE_VERSION }}
add-paths: "deployments/helm/*/Chart.yaml"
commit-message: "[skip ci] Update Helm Chart To ${{ steps.update.outputs.STABLE_VERSION }}"
committer: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
title: "[skip ci] Update Helm Chart To ${{ steps.update.outputs.STABLE_VERSION }}"
base: main
signoff: true
delete-branch: true