Skip to content

Commit 7689ff6

Browse files
committed
🤖 ci: unify :main image publishing with goreleaser
Route the :main GHCR publish job through GoReleaser so it shares the same image pipeline as release builds, and enable linux/arm64 alongside linux/amd64 in GoReleaser Docker outputs. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$0.61`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=0.61 -->
1 parent e0a1163 commit 7689ff6

2 files changed

Lines changed: 46 additions & 33 deletions

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ jobs:
6868
- 'go.mod'
6969
- 'go.sum'
7070
- 'vendor/**'
71+
- '.goreleaser.yaml'
7172
- 'Dockerfile*'
7273
- 'Dockerfile.goreleaser'
7374
terraform:
@@ -477,6 +478,7 @@ jobs:
477478
- name: Checkout
478479
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
479480
with:
481+
fetch-depth: 0
480482
persist-credentials: false
481483

482484
- name: Setup Go
@@ -485,16 +487,6 @@ jobs:
485487
go-version-file: go.mod
486488
cache: false
487489

488-
- name: Build linux/amd64 binary for image
489-
env:
490-
GOFLAGS: -mod=vendor
491-
CGO_ENABLED: "0"
492-
GOOS: linux
493-
GOARCH: amd64
494-
run: |
495-
mkdir -p linux/amd64
496-
go build -o linux/amd64/coder-k8s ./
497-
498490
- name: Set up Docker Buildx
499491
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
500492

@@ -505,29 +497,16 @@ jobs:
505497
username: ${{ github.actor }}
506498
password: ${{ secrets.GITHUB_TOKEN }}
507499

508-
- name: Compute OCI label values
509-
id: oci
510-
run: echo "created=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_OUTPUT"
511-
512-
- name: Build and push :main
513-
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5.4.0
500+
- name: Run GoReleaser (:main)
501+
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
514502
with:
515-
context: .
516-
file: Dockerfile.goreleaser
517-
push: true
518-
tags: ghcr.io/coder/coder-k8s:main
519-
labels: |
520-
org.opencontainers.image.created=${{ steps.oci.outputs.created }}
521-
org.opencontainers.image.source=https://github.com/coder/coder-k8s
522-
org.opencontainers.image.url=https://coder.github.io/coder-k8s/
523-
org.opencontainers.image.documentation=https://coder.github.io/coder-k8s/
524-
org.opencontainers.image.title=coder-k8s
525-
org.opencontainers.image.description=Kubernetes operator for Coder
526-
org.opencontainers.image.version=main
527-
org.opencontainers.image.revision=${{ github.sha }}
528-
org.opencontainers.image.vendor=Coder
529-
org.opencontainers.image.licenses=Apache-2.0
530-
org.opencontainers.image.authors=Coder
503+
distribution: goreleaser
504+
version: "~> v2"
505+
args: release --clean --skip=announce
506+
env:
507+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
508+
GORELEASER_CURRENT_TAG: v0.0.0-main
509+
GORELEASER_CHANNEL: main
531510

532511
- name: Trivy image scan (:main)
533512
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # v0.33.1

‎.goreleaser.yaml‎

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,41 @@ archives:
2626
- LICENSE
2727
- README.md
2828

29+
release:
30+
disable: '{{ eq .Env.GORELEASER_CHANNEL "main" }}'
31+
2932
dockers_v2:
30-
- id: coder-k8s-image
33+
- id: coder-k8s-image-main
34+
disable: '{{ ne .Env.GORELEASER_CHANNEL "main" }}'
35+
dockerfile: Dockerfile.goreleaser
36+
ids:
37+
- coder-k8s
38+
images:
39+
- ghcr.io/coder/coder-k8s
40+
tags:
41+
- main
42+
platforms:
43+
- linux/amd64
44+
- linux/arm64
45+
sbom: true
46+
labels:
47+
org.opencontainers.image.created: "{{ .Date }}"
48+
org.opencontainers.image.source: https://github.com/coder/coder-k8s
49+
org.opencontainers.image.url: https://coder.github.io/coder-k8s/
50+
org.opencontainers.image.documentation: https://coder.github.io/coder-k8s/
51+
org.opencontainers.image.title: coder-k8s
52+
org.opencontainers.image.description: Kubernetes operator for Coder
53+
org.opencontainers.image.version: main
54+
org.opencontainers.image.revision: "{{ .FullCommit }}"
55+
org.opencontainers.image.vendor: Coder
56+
org.opencontainers.image.licenses: Apache-2.0
57+
org.opencontainers.image.authors: Coder
58+
flags:
59+
- "--pull=true"
60+
- "--provenance=false"
61+
62+
- id: coder-k8s-image-release
63+
disable: '{{ eq .Env.GORELEASER_CHANNEL "main" }}'
3164
dockerfile: Dockerfile.goreleaser
3265
ids:
3366
- coder-k8s
@@ -38,6 +71,7 @@ dockers_v2:
3871
- latest
3972
platforms:
4073
- linux/amd64
74+
- linux/arm64
4175
sbom: true
4276
labels:
4377
org.opencontainers.image.created: "{{ .Date }}"

0 commit comments

Comments
 (0)