This repository was archived by the owner on Dec 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
88 lines (81 loc) · 3.12 KB
/
update-subchart.yaml
File metadata and controls
88 lines (81 loc) · 3.12 KB
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
name: Update subchart
on:
repository_dispatch:
types: [ sysdig-release ]
workflow_dispatch:
inputs:
tag:
description: 'The chart submodule will be updated to this tag'
jobs:
update-submodule:
runs-on: ubuntu-latest
env:
WORKFLOW_DISPATCH_TAG: ${{ github.event.inputs.tag }}
REPOSITORY_DISPATCH_TAG: ${{ github.event.client_payload.tag }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true
- name: Setup operator-sdk
run: |
export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)
export OS=$(uname | awk '{print tolower($0)}')
export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/v1.26.0
curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
chmod +x operator-sdk_${OS}_${ARCH} && sudo mv operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk
- name: Set tag
id: set_tag
run: |
set -ex
CHART_TAG=''
if [[ ! -z "$REPOSITORY_DISPATCH_TAG" ]]; then
echo "::set-output name=chart_tag::${REPOSITORY_DISPATCH_TAG}"
CHART_TAG="$REPOSITORY_DISPATCH_TAG"
elif [[ ! -z "$WORKFLOW_DISPATCH_TAG" ]]; then
echo "::set-output name=chart_tag::${WORKFLOW_DISPATCH_TAG}"
CHART_TAG="$WORKFLOW_DISPATCH_TAG"
fi
if [[ ! -z "$CHART_TAG" ]]; then
echo "${CHART_TAG} will be checked out!"
exit 0
else
echo "No tag found!"
exit 1
fi
- name: Checkout submodule
env:
CHART_TAG: ${{ steps.set_tag.outputs.chart_tag }}
working-directory: ./charts
run: |
git checkout $CHART_TAG
- name: Update VERSION in Makefile
env:
CHART_TAG: ${{ steps.set_tag.outputs.chart_tag }}
run: |
CHART_VERSION=$(echo "${CHART_TAG}" | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')
sed -i 's/VERSION\s*?=.*/VERSION ?= '${CHART_VERSION}'/' Makefile
- name: Update versions in bundle
run: |
make bundle
# - name: Commit back to repo
# uses: stefanzweifel/git-auto-commit-action@v4
# with:
# commit_message: Update charts submodule to ${{ steps.set_tag.outputs.chart_tag }}
# branch: ${{ steps.set_tag.outputs.chart_tag }}
- name: Create Pull Request
id: create_pull_request
uses: peter-evans/create-pull-request@v4
with:
branch: ${{ steps.set_tag.outputs.chart_tag }}
title: Update chart to ${{ steps.set_tag.outputs.chart_tag }}
commit-message: Update charts submodule to ${{ steps.set_tag.outputs.chart_tag }}
labels: automerge
- name: Automerge
id: automerge
uses: "pascalgn/automerge-action@v0.15.2"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
PULL_REQUEST: "${{ steps.create_pull_request.outputs.pull-request-number }}"
MERGE_METHOD: "squash"