-
Notifications
You must be signed in to change notification settings - Fork 116
214 lines (189 loc) · 9.09 KB
/
pre-release-workflow.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
name: Pre Release Workflow
on:
workflow_dispatch:
inputs:
release_version:
description: 'Version of Splunk Operator Release'
required: true
old_operator_version:
description: 'OLD OPERATOR VERSION'
required: true
new_operator_version:
description: 'NEW OPERATOR VERSION'
required: true
old_operator_image_version:
description: 'OLD OPERATOR IMAGE VERSION'
required: true
new_operator_image_version:
description: 'NEW OPERATOR IMAGE VERSION'
required: true
old_enterprise_version:
description: 'OLD ENTERPRISE IMAGE VERSION'
required: true
new_enterprise_version:
description: 'NEW ENTERPRISE IMAGE VERSION'
required: true
jobs:
automated-release:
name: Automated Pre Release
permissions:
# Need the write permission because this job commits changes to some folders like dist
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Deep Fetch
run: |
git fetch --prune --unshallow
- name: Create ChangeLog since last release
run: |
git log $(git describe --tags --abbrev=0)..HEAD --oneline >> docs/ChangeLog-NEW.md
- name: Dotenv Action
id: dotenv
uses: falti/dotenv-action@d4d12eaa0e1dd06d5bdc3d7af3bf4c8c93cb5359
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.5.0
- name: Configure Docker Credentials
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PUSH_TOKEN}}
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ steps.dotenv.outputs.GO_VERSION }}
- name: Install goveralls
run: |
go get github.com/mattn/goveralls@latest
- name: Update Operator Image name in Helm
if: github.event.inputs.old_operator_version != github.event.inputs.new_operator_version
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "splunk-operator:${{ github.event.inputs.old_operator_version }}"
replace: "splunk-operator:${{ github.event.inputs.new_operator_version }}"
exclude: "ChangeLog.md"
include: "values.yaml"
- name: Update Helm Version
if: github.event.inputs.old_operator_version != github.event.inputs.new_operator_version
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "version: ${{ github.event.inputs.old_operator_version }}"
replace: "version: ${{ github.event.inputs.new_operator_version }}"
exclude: "ChangeLog.md"
include: "Chart.yaml"
- name: Update Helm App Version
if: github.event.inputs.old_operator_version != github.event.inputs.new_operator_version
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "appVersion: ${{ github.event.inputs.old_operator_version }}"
replace: "appVersion: ${{ github.event.inputs.new_operator_version }}"
exclude: "ChangeLog.md"
include: "Chart.yaml"
- name: Display chart.yaml
run: |
cat helm-chart/splunk-operator/Chart.yaml
cat helm-chart/splunk-enterprise/Chart.yaml
- name: Update Operator Image name in DOCS
if: github.event.inputs.old_operator_version != github.event.inputs.new_operator_version
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "splunk-operator:${{ github.event.inputs.old_operator_version }}"
replace: "splunk-operator:${{ github.event.inputs.new_operator_version }}"
exclude: "ChangeLog.md"
include: "**.md"
- name: Update Splunk Operator Install URL in DOCS
if: github.event.inputs.old_operator_version != github.event.inputs.new_operator_version
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "/download/${{ github.event.inputs.old_operator_version }}/splunk-operator"
replace: "/download/${{ github.event.inputs.new_operator_version }}/splunk-operator"
exclude: "ChangeLog.md"
include: "**.md"
- name: Update Splunk Operator VERSION in DOCS
if: github.event.inputs.old_operator_version != github.event.inputs.new_operator_version
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "${{ github.event.inputs.old_operator_version }} or later"
replace: "${{ github.event.inputs.new_operator_version }} or later"
exclude: "ChangeLog.md"
include: "**.md"
- name: Update Splunk Operator upgrade string in DOCS
if: github.event.inputs.old_operator_version != github.event.inputs.new_operator_version
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "Steps to upgrade from version greater than 1.0.5 to ${{ github.event.inputs.old_operator_version }}"
replace: "Steps to upgrade from version greater than 1.0.5 to ${{ github.event.inputs.new_operator_version }}"
exclude: "ChangeLog.md"
include: "**.md"
- name: Update Splunk Operator Release URL in DOCS
if: github.event.inputs.old_operator_version != github.event.inputs.new_operator_version
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "https://github.com/splunk/splunk-operator/releases/download/${{ github.event.inputs.old_operator_version }}/splunk-operator-install.yaml"
replace: "https://github.com/splunk/splunk-operator/releases/download/${{ github.event.inputs.new_operator_version }}/splunk-operator-install.yaml"
exclude: "ChangeLog.md"
include: "**.md"
- name: Update Splunk Enterprise Image in operator.yaml
if: github.event.inputs.old_enterprise_version != github.event.inputs.new_enterprise_version
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "${{ github.event.inputs.old_enterprise_version }}"
replace: "${{ github.event.inputs.new_enterprise_version }}"
include: "**operator.yaml"
- name: Update Splunk Enterprise Release Image in .env file
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "${{ github.event.inputs.old_enterprise_version }}"
replace: "${{ github.event.inputs.new_enterprise_version }}"
include: ".env"
- name: Update Splunk Enterprise Image in helm
if: github.event.inputs.old_enterprise_version != github.event.inputs.new_enterprise_version
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "${{ github.event.inputs.old_enterprise_version }}"
replace: "${{ github.event.inputs.new_enterprise_version }}"
include: "**values.yaml"
- name: Update Splunk Enterprise image in DOCS
if: github.event.inputs.old_enterprise_version != github.event.inputs.new_enterprise_version
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "${{ github.event.inputs.old_enterprise_version }} or later"
replace: "${{ github.event.inputs.new_enterprise_version }} or later"
exclude: "ChangeLog.md"
include: "**.md"
- name: Install 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/${{ steps.dotenv.outputs.OPERATOR_SDK_VERSION }}
sudo curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
sudo chmod +x operator-sdk_${OS}_${ARCH}
sudo mv operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk
- name: Run Bundle Creation for the release
run: |
make bundle IMAGE_TAG_BASE=docker.io/splunk/splunk-operator VERSION=${{ github.event.inputs.release_version }} IMG=docker.io/splunk/splunk-operator:${{ github.event.inputs.release_version }} SPLUNK_ENTERPRISE_IMAGE=docker.io/splunk/splunk:${{ github.event.inputs.new_enterprise_version }}
- name: Run helm chart package creation
run: |
helm package helm-chart/splunk-operator
cp splunk-operator-${{ github.event.inputs.new_operator_version }}.tgz docs/
mv splunk-operator-${{ github.event.inputs.new_operator_version }}.tgz helm-chart/splunk-enterprise/charts
helm package helm-chart/splunk-enterprise
mv splunk-enterprise-${{ github.event.inputs.new_operator_version }}.tgz docs/
helm repo index --url https://splunk.github.io/splunk-operator/ docs/
- name: Reset go.mod and go.sum before creating Pull Request
run: |
git checkout go.sum
git checkout go.mod
git status
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3.10.1
with:
branch: "release/${{ github.event.inputs.release_version }}"
title: "Splunk Operator ${{ github.event.inputs.release_version }} release"
reviewers: "${{ steps.dotenv.outputs.REVIEWERS }}"
body: |
### Automated Pull Request for Splunk Operator Release ${{ github.event.inputs.release_version }}
* Changes added to docs/ChangeLog-NEW.md. Please filter and update ChangeLog.md
* Delete ChangeLog-New.md