Skip to content

Commit e1bd77b

Browse files
authored
Merge pull request #51 from crossplane-contrib/fix/provider-v1.81.183
fix: update CI
2 parents e5afa8d + 575c571 commit e1bd77b

File tree

2 files changed

+58
-44
lines changed

2 files changed

+58
-44
lines changed

.github/workflows/ci.yml

Lines changed: 58 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,23 @@ on:
66
- main
77
- release-*
88
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
1015

1116
env:
1217
# Common versions
1318
GO_VERSION: '1.20'
1419
GOLANGCI_VERSION: 'v1.53.3'
1520
DOCKER_BUILDX_VERSION: 'v0.8.2'
1621
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"
1726

1827
jobs:
1928
detect-noop:
@@ -50,14 +59,14 @@ jobs:
5059
run: echo "::set-output name=cache::$(make go.cachedir)"
5160

5261
- name: Cache the Go Build Cache
53-
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4
62+
uses: actions/cache@v4
5463
with:
5564
path: ${{ steps.go.outputs.cache }}
5665
key: ${{ runner.os }}-build-lint-${{ hashFiles('**/go.sum') }}
5766
restore-keys: ${{ runner.os }}-build-lint-
5867

5968
- name: Cache Go Dependencies
60-
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4
69+
uses: actions/cache@v4
6170
with:
6271
path: .work/pkg
6372
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
@@ -97,14 +106,14 @@ jobs:
97106
run: echo "::set-output name=cache::$(make go.cachedir)"
98107

99108
- name: Cache the Go Build Cache
100-
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4
109+
uses: actions/cache@v4
101110
with:
102111
path: ${{ steps.go.outputs.cache }}
103112
key: ${{ runner.os }}-build-check-diff-${{ hashFiles('**/go.sum') }}
104113
restore-keys: ${{ runner.os }}-build-check-diff-
105114

106115
- name: Cache Go Dependencies
107-
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4
116+
uses: actions/cache@v4
108117
with:
109118
path: .work/pkg
110119
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
@@ -140,14 +149,14 @@ jobs:
140149
run: echo "::set-output name=cache::$(make go.cachedir)"
141150

142151
- name: Cache the Go Build Cache
143-
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4
152+
uses: actions/cache@v4
144153
with:
145154
path: ${{ steps.go.outputs.cache }}
146155
key: ${{ runner.os }}-build-unit-tests-${{ hashFiles('**/go.sum') }}
147156
restore-keys: ${{ runner.os }}-build-unit-tests-
148157

149158
- name: Cache Go Dependencies
150-
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4
159+
uses: actions/cache@v4
151160
with:
152161
path: .work/pkg
153162
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
@@ -182,6 +191,13 @@ jobs:
182191
version: ${{ env.DOCKER_BUILDX_VERSION }}
183192
install: true
184193

194+
- name: Login to GHCR using PAT
195+
uses: docker/[email protected]
196+
with:
197+
registry: ghcr.io
198+
username: ${{ github.repository_owner }}
199+
password: ${{ secrets.GITHUB_TOKEN }}
200+
185201
- name: Checkout
186202
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
187203
with:
@@ -200,14 +216,14 @@ jobs:
200216
run: echo "::set-output name=cache::$(make go.cachedir)"
201217

202218
- name: Cache the Go Build Cache
203-
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4
219+
uses: actions/cache@v4
204220
with:
205221
path: ${{ steps.go.outputs.cache }}
206222
key: ${{ runner.os }}-build-publish-artifacts-${{ hashFiles('**/go.sum') }}
207223
restore-keys: ${{ runner.os }}-build-publish-artifacts-
208224

209225
- name: Cache Go Dependencies
210-
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4
226+
uses: actions/cache@v4
211227
with:
212228
path: .work/pkg
213229
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
@@ -217,7 +233,8 @@ jobs:
217233
run: make vendor vendor.check
218234

219235
- 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
221238
env:
222239
# We're using docker buildx, which doesn't actually load the images it
223240
# builds by default. Specifying --load does so.
@@ -229,17 +246,39 @@ jobs:
229246
name: output
230247
path: _output/**
231248

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+
uses: imjasonh/[email protected]
271+
272+
- name: Validate crane installation
273+
run: crane version
274+
232275
- name: Login to Upbound
233-
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3
234-
if: env.XPKG_ACCESS_ID != ''
276+
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
235277
with:
236-
registry: xpkg.upbound.io
278+
registry: "xpkg.upbound.io"
237279
username: ${{ secrets.XPKG_ACCESS_ID }}
238280
password: ${{ secrets.XPKG_TOKEN }}
239281

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

.github/workflows/publish-provider-package.yaml

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)