6
6
- main
7
7
- release-*
8
8
pull_request : {}
9
- workflow_dispatch : {}
9
+ workflow_dispatch :
10
+ inputs :
11
+ version :
12
+ description : " Version string to use while publishing the package (e.g. v1.0.0-alpha.1)"
13
+ default : ' '
14
+ required : false
10
15
11
16
env :
12
17
# Common versions
13
18
GO_VERSION : ' 1.20'
14
19
GOLANGCI_VERSION : ' v1.53.3'
15
20
DOCKER_BUILDX_VERSION : ' v0.8.2'
16
21
XPKG_ACCESS_ID : ${{ secrets.XPKG_ACCESS_ID }}
22
+ CROSSPLANE_REGORG : ' ghcr.io/crossplane-contrib'
23
+ UPBOUND_REGORG : ' xpkg.upbound.io/crossplane-contrib'
24
+ PROVIDER_REPO : provider-tencentcloud
25
+ UP_DOMAIN : " https://upbound.io"
17
26
18
27
jobs :
19
28
detect-noop :
@@ -50,14 +59,14 @@ jobs:
50
59
run : echo "::set-output name=cache::$(make go.cachedir)"
51
60
52
61
- name : Cache the Go Build Cache
53
- uses : actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4
62
+ uses : actions/cache@v4
54
63
with :
55
64
path : ${{ steps.go.outputs.cache }}
56
65
key : ${{ runner.os }}-build-lint-${{ hashFiles('**/go.sum') }}
57
66
restore-keys : ${{ runner.os }}-build-lint-
58
67
59
68
- name : Cache Go Dependencies
60
- uses : actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4
69
+ uses : actions/cache@v4
61
70
with :
62
71
path : .work/pkg
63
72
key : ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
@@ -97,14 +106,14 @@ jobs:
97
106
run : echo "::set-output name=cache::$(make go.cachedir)"
98
107
99
108
- name : Cache the Go Build Cache
100
- uses : actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4
109
+ uses : actions/cache@v4
101
110
with :
102
111
path : ${{ steps.go.outputs.cache }}
103
112
key : ${{ runner.os }}-build-check-diff-${{ hashFiles('**/go.sum') }}
104
113
restore-keys : ${{ runner.os }}-build-check-diff-
105
114
106
115
- name : Cache Go Dependencies
107
- uses : actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4
116
+ uses : actions/cache@v4
108
117
with :
109
118
path : .work/pkg
110
119
key : ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
@@ -140,14 +149,14 @@ jobs:
140
149
run : echo "::set-output name=cache::$(make go.cachedir)"
141
150
142
151
- name : Cache the Go Build Cache
143
- uses : actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4
152
+ uses : actions/cache@v4
144
153
with :
145
154
path : ${{ steps.go.outputs.cache }}
146
155
key : ${{ runner.os }}-build-unit-tests-${{ hashFiles('**/go.sum') }}
147
156
restore-keys : ${{ runner.os }}-build-unit-tests-
148
157
149
158
- name : Cache Go Dependencies
150
- uses : actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4
159
+ uses : actions/cache@v4
151
160
with :
152
161
path : .work/pkg
153
162
key : ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
@@ -182,6 +191,13 @@ jobs:
182
191
version : ${{ env.DOCKER_BUILDX_VERSION }}
183
192
install : true
184
193
194
+ - name : Login to GHCR using PAT
195
+
196
+ with :
197
+ registry : ghcr.io
198
+ username : ${{ github.repository_owner }}
199
+ password : ${{ secrets.GITHUB_TOKEN }}
200
+
185
201
- name : Checkout
186
202
uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
187
203
with :
@@ -200,14 +216,14 @@ jobs:
200
216
run : echo "::set-output name=cache::$(make go.cachedir)"
201
217
202
218
- name : Cache the Go Build Cache
203
- uses : actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4
219
+ uses : actions/cache@v4
204
220
with :
205
221
path : ${{ steps.go.outputs.cache }}
206
222
key : ${{ runner.os }}-build-publish-artifacts-${{ hashFiles('**/go.sum') }}
207
223
restore-keys : ${{ runner.os }}-build-publish-artifacts-
208
224
209
225
- name : Cache Go Dependencies
210
- uses : actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4
226
+ uses : actions/cache@v4
211
227
with :
212
228
path : .work/pkg
213
229
key : ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
@@ -217,7 +233,8 @@ jobs:
217
233
run : make vendor vendor.check
218
234
219
235
- name : Build Artifacts
220
- run : make -j2 build.all
236
+ run : |-
237
+ make -j XPKG_REG_ORGS="${{ env.CROSSPLANE_REGORG }}" XPKG_REG_ORGS_NO_PROMOTE="${{ env.CROSSPLANE_REGORG }}" BRANCH_NAME="main" ${{ inputs.version != '' && format('VERSION={0}', inputs.version) || '' }} build.all
221
238
env :
222
239
# We're using docker buildx, which doesn't actually load the images it
223
240
# builds by default. Specifying --load does so.
@@ -229,17 +246,39 @@ jobs:
229
246
name : output
230
247
path : _output/**
231
248
249
+ - name : Publish Artifacts
250
+ run : |-
251
+ make -j2 XPKG_REG_ORGS="${{ env.CROSSPLANE_REGORG }}" XPKG_REG_ORGS_NO_PROMOTE="${{ env.CROSSPLANE_REGORG }}" BRANCH_NAME="main" ${{ inputs.version != '' && format('VERSION={0}', inputs.version) || '' }} publish
252
+
253
+ mirror-to-xpkg-upbound-io :
254
+ needs : publish-artifacts
255
+ runs-on : ubuntu-22.04
256
+ steps :
257
+ - name : Setup QEMU
258
+ uses : docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2
259
+ with :
260
+ platforms : all
261
+
262
+ - name : Setup Docker Buildx
263
+ uses : docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2
264
+ with :
265
+ version : ${{ env.DOCKER_BUILDX_VERSION }}
266
+ install : true
267
+
268
+ - name : Setup crane
269
+ # crane will inherit credentials from `docker login`
270
+
271
+
272
+ - name : Validate crane installation
273
+ run : crane version
274
+
232
275
- name : Login to Upbound
233
- uses : docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3
234
- if : env.XPKG_ACCESS_ID != ''
276
+ uses : docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
235
277
with :
236
- registry : xpkg.upbound.io
278
+ registry : " xpkg.upbound.io"
237
279
username : ${{ secrets.XPKG_ACCESS_ID }}
238
280
password : ${{ secrets.XPKG_TOKEN }}
239
281
240
- - name : Publish Artifacts
241
- run : make publish BRANCH_NAME=${GITHUB_REF##*/}
242
- if : env.XPKG_ACCESS_ID != ''
243
- env :
244
- UPBOUND_MARKETPLACE_PUSH_ROBOT_USR : ${{ secrets.XPKG_ACCESS_ID }}
245
- UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW : ${{ secrets.XPKG_TOKEN }}
282
+ - name : Mirror to xpkg.upbound.io
283
+ run : |
284
+ crane copy ${{ env.CROSSPLANE_REGORG }}/${{ env.PROVIDER_REPO }}:${{ inputs.version }} ${{ env.UPBOUND_REGORG }}/${{ env.PROVIDER_REPO }}:${{ inputs.version }} --allow-nondistributable-artifacts
0 commit comments