-
Notifications
You must be signed in to change notification settings - Fork 32
164 lines (140 loc) · 6.12 KB
/
quick-release.yml
File metadata and controls
164 lines (140 loc) · 6.12 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
name: Quick Release
on:
workflow_dispatch:
inputs:
push-to-upbound:
description: 'Mirror to Upbound registry'
required: false
type: boolean
default: true
env:
# Common versions
GO_VERSION: '1.24'
GOLANGCI_VERSION: 'v2.0.0'
DOCKER_BUILDX_VERSION: 'v0.22.0'
UP_VERSION: 'v0.38.4'
# Registry/Org names
CROSSPLANE_REGORG: 'ghcr.io/crossplane-contrib'
UPBOUND_REGORG: 'xpkg.upbound.io/crossplane-contrib'
PROVIDER_REPO: provider-keycloak
# Upbound registry specific variables
UP_DOMAIN: "https://upbound.io"
jobs:
build-and-publish:
runs-on: ubuntu-24.04
outputs:
version: ${{ steps.version.outputs.VERSION }}
permissions:
packages: write
contents: read
steps:
- name: Setup QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
with:
platforms: all
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
with:
version: ${{ env.DOCKER_BUILDX_VERSION }}
install: true
- name: Login to GHCR
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
with:
submodules: true
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6
with:
go-version: ${{ env.GO_VERSION }}
- name: Find the Go Build Cache
id: go
run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT
- name: Cache the Go Build Cache
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5
with:
path: ${{ steps.go.outputs.cache }}
key: ${{ runner.os }}-build-publish-artifacts-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-build-publish-artifacts-
- name: Cache Go Dependencies
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-
- name: Vendor Dependencies
run: make vendor vendor.check
- name: Find the version
id: version
run: make common.buildvars >> $GITHUB_OUTPUT
- name: Build Artifacts
run: |-
make -j2 XPKG_REG_ORGS="${{ env.CROSSPLANE_REGORG }}" XPKG_REG_ORGS_NO_PROMOTE="${{ env.CROSSPLANE_REGORG }}" BRANCH_NAME="main" VERSION="${{ steps.version.outputs.VERSION }}" build.all
env:
# We're using docker buildx, which doesn't actually load the images it
# builds by default. Specifying --load does so.
BUILD_ARGS: "--load"
- name: Upload Artifacts to GitHub
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: output
path: _output/**
- name: Publish Artifacts
run: |-
make -j2 XPKG_REG_ORGS="${{ env.CROSSPLANE_REGORG }}" XPKG_REG_ORGS_NO_PROMOTE="${{ env.CROSSPLANE_REGORG }}" BRANCH_NAME="main" VERSION="${{ steps.version.outputs.VERSION }}" publish
mirror-to-upbound:
runs-on: ubuntu-24.04
needs: build-and-publish
if: ${{ inputs.push-to-upbound && needs.build-and-publish.result == 'success' }}
steps:
- name: Setup QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
with:
platforms: all
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
with:
version: ${{ env.DOCKER_BUILDX_VERSION }}
install: true
- name: Setup crane
uses: imjasonh/setup-crane@31b88efe9de28ae0ffa220711af4b60be9435f6e # v0.4
- name: Validate crane installation
run: crane version
- name: Login to Upbound
uses: docker/login-action@0567fa5ae8c9a197cb207537dc5cbb43ca3d803f
with:
registry: "xpkg.upbound.io"
username: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }}
password: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW }}
- name: Mirror to xpkg.upbound.io
run: |
crane copy ${{ env.CROSSPLANE_REGORG }}/${{ env.PROVIDER_REPO }}:${{ needs.build-and-publish.outputs.version }} ${{ env.UPBOUND_REGORG }}/${{ env.PROVIDER_REPO }}:${{ needs.build-and-publish.outputs.version }} --allow-nondistributable-artifacts
summary:
runs-on: ubuntu-24.04
needs: [build-and-publish, mirror-to-upbound]
if: always()
steps:
- name: Summary
run: |
echo "## Quick Release Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Version:** ${{ needs.build-and-publish.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Published Artifacts:" >> $GITHUB_STEP_SUMMARY
echo "- **GHCR:** \`${{ env.CROSSPLANE_REGORG }}/${{ env.PROVIDER_REPO }}:${{ needs.build-and-publish.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
if [[ "${{ needs.mirror-to-upbound.result }}" == "success" ]]; then
echo "- **Upbound:** \`${{ env.UPBOUND_REGORG }}/${{ env.PROVIDER_REPO }}:${{ needs.build-and-publish.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
else
echo "- **Upbound:** ⚠️ Skipped or Failed" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Job Results:" >> $GITHUB_STEP_SUMMARY
echo "- **Lint:** ${{ needs.lint.result || 'skipped' }}" >> $GITHUB_STEP_SUMMARY
echo "- **Unit Tests:** ${{ needs.unit-tests.result || 'skipped' }}" >> $GITHUB_STEP_SUMMARY
echo "- **Build & Publish:** ${{ needs.build-and-publish.result }}" >> $GITHUB_STEP_SUMMARY
echo "- **Mirror to Upbound:** ${{ needs.mirror-to-upbound.result || 'skipped' }}" >> $GITHUB_STEP_SUMMARY