-
Notifications
You must be signed in to change notification settings - Fork 3
189 lines (165 loc) · 5.67 KB
/
release.yaml
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
name: Release
on:
push:
tags:
- "*"
jobs:
version:
name: Version
runs-on: ubuntu-latest
outputs:
buid_date: ${{ steps.version.outputs.buid_date }}
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch tags
run: git fetch --force --tags
- name: Get Version
id: version
run: |
VERSION=sha-${GITHUB_SHA::8}
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF/refs\/tags\//}
fi
echo ::set-output name=buid_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
echo ::set-output name=version::${VERSION}
check-diff:
name: Check diff
runs-on: ubuntu-latest
needs: version
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Generate bundle
run: make bundle
env:
VERSION: "${{ needs.version.outputs.version }}"
- name: Check diff
uses: mmontes11/[email protected]
with:
message: Bundle is not up to date with the version '${{ needs.version.outputs.version }}'. Run 'make bundle' and commit the changes.
operator:
name: Operator
runs-on: ubuntu-latest
needs:
- version
- check-diff
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Fetch tags
run: git fetch --force --tags
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
id: buildx
- name: Login to container Registry
uses: docker/login-action@v2
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GHA_TOKEN }}
registry: ghcr.io
- name: Sync chart
run: make sync-chart
env:
VERSION: "${{ needs.version.outputs.version }}"
- name: Publish operator image
uses: docker/build-push-action@v2
with:
push: true
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile
platforms: linux/arm64,linux/amd64
tags: |
ghcr.io/${{ github.repository_owner }}/mariadb-operator-helm:${{ needs.version.outputs.version }}
ghcr.io/${{ github.repository_owner }}/mariadb-operator-helm:latest
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ needs.version.outputs.version }}
org.opencontainers.image.created=${{ needs.version.outputs.build_date }}
bundle:
name: Bundle
runs-on: ubuntu-latest
needs:
- version
- check-diff
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Fetch tags
run: git fetch --force --tags
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
id: buildx
- name: Login to container Registry
uses: docker/login-action@v2
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GHA_TOKEN }}
registry: ghcr.io
- name: Publish operator image
uses: docker/build-push-action@v2
with:
push: true
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./bundle.Dockerfile
platforms: linux/arm64,linux/amd64
tags: |
ghcr.io/${{ github.repository_owner }}/mariadb-operator-helm-bundle:${{ needs.version.outputs.version }}
ghcr.io/${{ github.repository_owner }}/mariadb-operator-helm-bundle:latest
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ needs.version.outputs.version }}
org.opencontainers.image.created=${{ needs.version.outputs.build_date }}
sync-repos:
name: Sync repos
runs-on: ubuntu-latest
needs:
- version
- check-diff
- bundle
- operator
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Checkout community-operators
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: "mariadb-operator/community-operators"
path: "community-operators"
token: "${{ secrets.GHA_TOKEN }}"
- name: Checkout community-operators-prod
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: "mariadb-operator/community-operators-prod"
path: "community-operators-prod"
token: "${{ secrets.GHA_TOKEN }}"
- name: Sync repos
run: make sync-upstream-repos
env:
VERSION: "${{ needs.version.outputs.version }}"
GITHUB_TOKEN: "${{ secrets.GHA_TOKEN }}"