Skip to content

Commit 5daa877

Browse files
authored
Multi-arch images with Github Actions (#95)
1 parent 39588c1 commit 5daa877

File tree

4 files changed

+106
-13
lines changed

4 files changed

+106
-13
lines changed

.github/workflows/release.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
Release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version: stable
24+
25+
- name: Test
26+
run: make test
27+
28+
- name: Set up QEMU
29+
uses: docker/setup-qemu-action@v3
30+
31+
- name: Login to Quay.io
32+
uses: docker/login-action@v3
33+
with:
34+
registry: quay.io
35+
username: ${{ secrets.QUAY_USERNAME }}
36+
password: ${{ secrets.QUAY_PASSWORD }}
37+
38+
- name: Run GoReleaser
39+
uses: goreleaser/goreleaser-action@v5
40+
with:
41+
distribution: goreleaser
42+
version: "~> v1"
43+
args: release --clean
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '*'
7+
8+
jobs:
9+
Test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@master
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v5
19+
with:
20+
go-version: stable
21+
22+
- name: Test
23+
run: make test

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*.dylib
66
bin/
77
.idea/
8+
dist/
89
# Test binary, build with `go test -c`
910
*.test
1011
*.iml

.goreleaser.yml

+37-13
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,16 @@
33
project_name: kube-cleanup-operator
44

55
builds:
6-
- binary: kube-cleanup-operator
6+
- id: build
7+
binary: kube-cleanup-operator
78
main: ./cmd/main.go
89
env:
910
- CGO_ENABLED=0
1011
goos:
11-
- darwin
1212
- linux
1313
goarch:
1414
- amd64
1515
- arm64
16-
- arm7
17-
ignore:
18-
- goos: darwin
19-
goarch: arm7
20-
- goos: darwin
21-
goarch: arm64
2216

2317
release:
2418
github:
@@ -27,11 +21,41 @@ release:
2721
prerelease: true
2822

2923
dockers:
30-
- dockerfile: Dockerfile.releaser
31-
binaries:
32-
- kube-cleanup-operator
24+
- id: release-amd64
25+
dockerfile: Dockerfile.releaser
26+
use: buildx
3327
goos: linux
3428
goarch: amd64
29+
ids:
30+
- build
31+
build_flag_templates:
32+
- "--pull"
33+
- "--platform=linux/amd64"
3534
image_templates:
36-
- 'quay.io/lwolf/kube-cleanup-operator:{{ .Tag }}'
37-
- 'quay.io/lwolf/kube-cleanup-operator:latest'
35+
- "quay.io/lwolf/kube-cleanup-operator:{{ .Version }}-amd64"
36+
37+
- id: release-arm64
38+
dockerfile: Dockerfile.releaser
39+
use: buildx
40+
goos: linux
41+
goarch: arm64
42+
ids:
43+
- build
44+
build_flag_templates:
45+
- "--pull"
46+
- "--platform=linux/arm64"
47+
image_templates:
48+
- "quay.io/lwolf/kube-cleanup-operator:{{ .Version }}-arm64"
49+
50+
docker_manifests:
51+
- id: manifest-release
52+
name_template: "quay.io/lwolf/kube-cleanup-operator:{{ .Version }}"
53+
image_templates:
54+
- "quay.io/lwolf/kube-cleanup-operator:{{ .Version }}-amd64"
55+
- "quay.io/lwolf/kube-cleanup-operator:{{ .Version }}-arm64"
56+
57+
- id: manifest-latest
58+
name_template: "quay.io/lwolf/kube-cleanup-operator:latest"
59+
image_templates:
60+
- "quay.io/lwolf/kube-cleanup-operator:{{ .Version }}-amd64"
61+
- "quay.io/lwolf/kube-cleanup-operator:{{ .Version }}-arm64"

0 commit comments

Comments
 (0)