-
Notifications
You must be signed in to change notification settings - Fork 35
198 lines (173 loc) · 6.3 KB
/
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
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
name: Release Workflow
on:
release:
types:
- published
env:
GO_VERSION: 1.19
HELM_VERSION: v3.6.3
REDIS_VERSION: 6.2.7
CRD_PATH: charts/operator-for-redis/crds/db.ibm.com_redisclusters.yaml
CRD_DIFF: crd.diff
jobs:
operator:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.meta.outputs.version }}
steps:
- name: Setup Buildx
uses: docker/setup-buildx-action@v2
- name: Prepare image metadata
uses: docker/metadata-action@v4
id: meta
with:
images: |
ibmcom/operator-for-redis
tags: type=ref,event=tag
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push operator image
uses: docker/build-push-action@v3
with:
file: Dockerfile.operator
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
OPERATOR_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
cluster-node:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.meta.outputs.version }}
steps:
- name: Setup Buildx
uses: docker/setup-buildx-action@v2
- name: Prepare image metadata
uses: docker/metadata-action@v4
id: meta
with:
images: |
ibmcom/node-for-redis
tags: type=ref,event=tag
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push cluster node image
uses: docker/build-push-action@v3
with:
file: Dockerfile.node
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
OPERATOR_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
metrics:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.meta.outputs.version }}
steps:
- name: Setup Buildx
uses: docker/setup-buildx-action@v2
- name: Prepare image metadata
uses: docker/metadata-action@v4
id: meta
with:
images: |
ibmcom/metrics-for-redis
tags: type=ref,event=tag
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push metrics image
uses: docker/build-push-action@v3
with:
file: Dockerfile.metrics
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
OPERATOR_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
helm-release:
runs-on: ubuntu-latest
needs: [ operator, cluster-node, metrics ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Helm
uses: azure/[email protected]
with:
version: ${{ env.HELM_VERSION }}
- name: Ensure helm-releases folder exists
run: mkdir -p helm-releases
- name: Package operator-for-redis chart
env:
OPERATOR_VERSION: ${{ needs.operator.outputs.version }}
run: helm package charts/operator-for-redis --version=$OPERATOR_VERSION --destination helm-releases
- name: Package node-for-redis chart
env:
OPERATOR_VERSION: ${{ needs.operator.outputs.version }}
run: helm package charts/node-for-redis --version=$OPERATOR_VERSION --app-version=${{ env.REDIS_VERSION }} --destination helm-releases
- name: Push helm charts
env:
OPERATOR_VERSION: ${{ needs.operator.outputs.version }}
run: |
git config --global user.email ""
git config --global user.name "Github Actions CI"
helm repo index helm-releases --url https://raw.githubusercontent.com/IBM/operator-for-redis-cluster/main/helm-releases
git add helm-releases/*
git commit -a -m "Release $OPERATOR_VERSION"
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} HEAD:main
docs:
name: Publish Docs
needs: [ helm-release ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.17.1 # This is recommended LTS version which includes npm 6.14.10
- name: Publish docs website
env:
USE_SSH: false
GIT_USER: git
CURRENT_BRANCH: main
DEPLOYMENT_BRANCH: gh-pages
GIT_PASS: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "gh-actions"
cd ./docs
npm ci
npx docusaurus deploy
assets:
name: Publish Assets
needs: [ docs ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Build redis plugin
run: make build-kubectl-rc
- name: Publish redis plugin to assets
uses: skx/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: './bin/kubectl-rc'