-
-
Notifications
You must be signed in to change notification settings - Fork 0
306 lines (262 loc) · 10.2 KB
/
release.yml
File metadata and controls
306 lines (262 loc) · 10.2 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
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
name: Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 1.0.1)'
required: true
type: string
env:
REGISTRY: ghcr.io
CONTROLLER_IMAGE: ghcr.io/${{ github.repository }}
OPERATOR_IMAGE: ghcr.io/${{ github.repository_owner }}/object-lease-operator-controller
PLUGIN_IMAGE: ghcr.io/${{ github.repository_owner }}/object-lease-console-plugin
BUNDLE_IMAGE: ghcr.io/${{ github.repository_owner }}/object-lease-operator-bundle
CATALOG_IMAGE: ghcr.io/${{ github.repository_owner }}/object-lease-operator-catalog
# Platforms to build for. Keep this single-sourced to make release changes simpler.
PLATFORMS: linux/arm64,linux/amd64
permissions:
contents: write
packages: write
jobs:
prepare:
name: Prepare Release
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
version_tag: ${{ steps.version.outputs.version_tag }}
steps:
- name: Determine Version
id: version
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="${GITHUB_REF#refs/tags/v}"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "version_tag=v${VERSION}" >> $GITHUB_OUTPUT
echo "Release version: ${VERSION}"
build-controller:
name: Build and Push Controller
needs: prepare
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
- name: Set up Go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
with:
go-version-file: 'go.mod'
- name: Run Tests
run: make test
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3
- name: Login to GitHub Container Registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Controller Image
run: |
make docker-buildx \
IMG=${{ env.CONTROLLER_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \
PLATFORMS=${{ env.PLATFORMS }}
- name: Tag Latest
run: |
docker buildx imagetools create \
${{ env.CONTROLLER_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \
--tag ${{ env.CONTROLLER_IMAGE }}:latest
build-plugin:
name: Build and Push Console Plugin
needs: prepare
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
- name: Set up Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
node-version: '24'
- name: Install Dependencies
working-directory: object-lease-console-plugin
run: yarn install
- name: Build Plugin
working-directory: object-lease-console-plugin
run: yarn build
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3
- name: Login to GitHub Container Registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Plugin Image
run: |
make plugin-buildx \
PLUGIN_IMG=${{ env.PLUGIN_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \
PLATFORMS=${{ env.PLATFORMS }}
- name: Tag Latest
run: |
docker buildx imagetools create \
${{ env.PLUGIN_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \
--tag ${{ env.PLUGIN_IMAGE }}:latest
build-operator:
name: Build and Push Operator
needs: [prepare, build-controller]
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3
- name: Login to GitHub Container Registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Operator Image
working-directory: object-lease-operator
run: |
make docker-buildx \
IMG=${{ env.OPERATOR_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \
VERSION=${{ needs.prepare.outputs.version }} \
PLATFORMS=${{ env.PLATFORMS }}
- name: Tag Latest
run: |
docker buildx imagetools create \
${{ env.OPERATOR_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \
--tag ${{ env.OPERATOR_IMAGE }}:latest
build-bundle:
name: Build and Push Operator Bundle
needs: [prepare, build-operator]
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
- name: Login to GitHub Container Registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Bundle
working-directory: object-lease-operator
run: |
make bundle-push \
IMG=${{ env.OPERATOR_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \
BUNDLE_IMG=${{ env.BUNDLE_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \
VERSION=${{ needs.prepare.outputs.version }}
- name: Tag Latest
run: |
docker buildx imagetools create \
${{ env.BUNDLE_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \
--tag ${{ env.BUNDLE_IMAGE }}:latest
build-catalog:
name: Build and Push Operator Catalog
needs: [prepare, build-bundle]
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
- name: Login to GitHub Container Registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Catalog
working-directory: object-lease-operator
run: |
make catalog-push \
BUNDLE_IMGS=${{ env.BUNDLE_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \
CATALOG_IMG=${{ env.CATALOG_IMAGE }}:${{ needs.prepare.outputs.version_tag }}
- name: Tag Latest
run: |
docker buildx imagetools create \
${{ env.CATALOG_IMAGE }}:${{ needs.prepare.outputs.version_tag }} \
--tag ${{ env.CATALOG_IMAGE }}:latest
create-release:
name: Create GitHub Release
needs: [prepare, build-controller, build-plugin, build-operator, build-bundle, build-catalog]
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
with:
fetch-depth: 0
- name: Generate Release Notes
id: release_notes
run: |
cat << 'FEOF' > release_notes.md
## Object Lease Controller v${{ needs.prepare.outputs.version_tag }}
### Container Images
- **Controller**: `${{ env.CONTROLLER_IMAGE }}:${{ needs.prepare.outputs.version_tag }}`
- **Console Plugin**: `${{ env.PLUGIN_IMAGE }}:${{ needs.prepare.outputs.version_tag }}`
- **Operator**: `${{ env.OPERATOR_IMAGE }}:${{ needs.prepare.outputs.version_tag }}`
- **Bundle**: `${{ env.BUNDLE_IMAGE }}:${{ needs.prepare.outputs.version_tag }}`
- **Catalog**: `${{ env.CATALOG_IMAGE }}:${{ needs.prepare.outputs.version_tag }}`
### Installation
#### Install Operator from Catalog
```bash
kubectl apply -f - <<EOF
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: object-lease-operator-catalog
namespace: openshift-marketplace
spec:
sourceType: grpc
image: ${{ env.CATALOG_IMAGE }}:latest
displayName: Object Lease Operator
publisher: ullbergm
updateStrategy:
registryPoll:
interval: 10m
EOF
```
#### Direct Deployment
```bash
kubectl apply -k github.com/ullbergm/object-lease-controller/object-lease-operator/config/default?ref=${{ needs.prepare.outputs.version_tag }}
```
FEOF
cat release_notes.md
- name: Create Release
uses: softprops/action-gh-release@5be0e66d93ac7ed76da52eca8bb058f665c3a5fe # v2
with:
tag_name: ${{ needs.prepare.outputs.version_tag }}
name: Release ${{ needs.prepare.outputs.version_tag }}
body_path: release_notes.md
draft: false
prerelease: false
generate_release_notes: true