Skip to content

Commit 4c2c0bb

Browse files
Clean up release.yaml CI:
Use new make target for building and pushing images. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
1 parent 0f464ce commit 4c2c0bb

File tree

3 files changed

+12
-71
lines changed

3 files changed

+12
-71
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
env:
99
CGO_ENABLED: 0
10-
GO_VERSION: '1.25.1'
10+
GO_VERSION: '1.25'
1111
REGISTRY: ghcr.io
1212
# github.repository as <account>/<repo>
1313
IMAGE_NAME: ${{ github.repository }}

.github/workflows/release.yaml

Lines changed: 6 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ on:
77
env:
88
REGISTRY: ghcr.io
99
IMAGE_NAME: ${{ github.repository }}
10-
GO_VERSION: '1.24'
10+
GO_VERSION: '1.25'
1111

1212
jobs:
13-
manager-image:
14-
name: Build and push manager image
13+
build-image:
14+
name: Build and push image
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout code
@@ -22,63 +22,21 @@ jobs:
2222
go-version: "${{ env.GO_VERSION }}"
2323
cache: true
2424

25-
- name: Set up QEMU
26-
uses: docker/setup-qemu-action@v3
27-
28-
- name: Set up Docker Buildx
29-
uses: docker/setup-buildx-action@v3
30-
31-
- name: Cache Docker layers
32-
uses: actions/cache@v4
33-
with:
34-
path: /tmp/.buildx-cache
35-
key: ${{ runner.os }}-buildx-manager-${{ github.sha }}
36-
restore-keys: |
37-
${{ runner.os }}-buildx-manager-
38-
${{ runner.os }}-buildx-
39-
40-
- name: Docker manager metadata
41-
id: meta
42-
uses: docker/metadata-action@v5
43-
with:
44-
github-token: ${{ secrets.GITHUB_TOKEN }}
45-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
46-
flavor: latest=false
47-
tags: type=ref,event=tag
48-
4925
- name: Log in to the Container registry
5026
uses: docker/login-action@v3
5127
with:
5228
registry: ${{ env.REGISTRY }}
5329
username: ${{ github.actor }}
5430
password: ${{ secrets.GITHUB_TOKEN }}
5531

56-
- name: Build and push manager image
57-
uses: docker/build-push-action@v6
58-
with:
59-
context: .
60-
push: true
61-
build-args: |
62-
LDFLAGS=${{ env.DOCKER_BUILD_LDFLAGS }}
63-
tags: ${{ steps.meta.outputs.tags }}
64-
labels: ${{ steps.meta.outputs.labels }}
65-
platforms: linux/amd64,linux/arm64
66-
cache-from: type=local,src=/tmp/.buildx-cache
67-
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
68-
69-
- name: Move cache
70-
# Temp fix
71-
# https://github.com/docker/build-push-action/issues/252
72-
# https://github.com/moby/buildkit/issues/1896
73-
run: |
74-
rm -rf /tmp/.buildx-cache
75-
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
32+
- name: Build and push image
33+
run: make image-build-push
7634

7735
release:
7836
name: Release
7937
runs-on: ubuntu-latest
8038
needs:
81-
- manager-image
39+
- build-image
8240
steps:
8341
- uses: actions/checkout@v5
8442

@@ -87,23 +45,6 @@ jobs:
8745
go-version: "${{ env.GO_VERSION }}"
8846
cache: true
8947

90-
- uses: actions/cache@v4
91-
with:
92-
path: bin
93-
key: ${{ runner.os }}-tools-bin-release-${{ hashFiles('Makefile') }}
94-
restore-keys: |
95-
${{ runner.os }}-tools-bin-release-
96-
${{ runner.os }}-tools-bin-
97-
98-
- name: Docker manager metadata
99-
id: meta
100-
uses: docker/metadata-action@v5
101-
with:
102-
github-token: ${{ secrets.GITHUB_TOKEN }}
103-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
104-
flavor: latest=false
105-
tags: type=ref,event=tag
106-
10748
- name: manifest
10849
run: make release
10950

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,17 @@ generate-manifests: tools ## Generate manifests e.g. CRD, RBAC etc.
138138
build: generate $(GORELEASER) ## Build the CAPT binary
139139
${GORELEASER} build --snapshot --clean
140140

141-
## --------------------------------------
142-
## Container image build
143-
## --------------------------------------
144-
145141
.PHONY: build-image
146142
build-image: $(GORELEASER) ## Build the container image
147143
${GORELEASER} release --snapshot --clean --verbose
148144

149145
.PHONY: image-build-push
150146
image-build-push: $(GORELEASER) ## Build and push the container image
151-
${GORELEASER} release --clean --verbose --skip=validate
147+
${GORELEASER} release --clean --verbose
148+
149+
## --------------------------------------
150+
## Manifest Image Update
151+
## --------------------------------------
152152

153153
.PHONY: set-manifest-image
154154
set-manifest-image:

0 commit comments

Comments
 (0)