Skip to content

Commit

Permalink
Multi-arch images with Github Actions (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
awilmore committed May 29, 2024
1 parent 39588c1 commit 5daa877
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 13 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release

on:
push:
tags:
- "*"

permissions:
contents: write

jobs:
Release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Test
run: make test

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Login to Quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: "~> v1"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test

on:
pull_request:
branches:
- '*'

jobs:
Test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Test
run: make test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*.dylib
bin/
.idea/
dist/
# Test binary, build with `go test -c`
*.test
*.iml
Expand Down
50 changes: 37 additions & 13 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,16 @@
project_name: kube-cleanup-operator

builds:
- binary: kube-cleanup-operator
- id: build
binary: kube-cleanup-operator
main: ./cmd/main.go
env:
- CGO_ENABLED=0
goos:
- darwin
- linux
goarch:
- amd64
- arm64
- arm7
ignore:
- goos: darwin
goarch: arm7
- goos: darwin
goarch: arm64

release:
github:
Expand All @@ -27,11 +21,41 @@ release:
prerelease: true

dockers:
- dockerfile: Dockerfile.releaser
binaries:
- kube-cleanup-operator
- id: release-amd64
dockerfile: Dockerfile.releaser
use: buildx
goos: linux
goarch: amd64
ids:
- build
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
image_templates:
- 'quay.io/lwolf/kube-cleanup-operator:{{ .Tag }}'
- 'quay.io/lwolf/kube-cleanup-operator:latest'
- "quay.io/lwolf/kube-cleanup-operator:{{ .Version }}-amd64"

- id: release-arm64
dockerfile: Dockerfile.releaser
use: buildx
goos: linux
goarch: arm64
ids:
- build
build_flag_templates:
- "--pull"
- "--platform=linux/arm64"
image_templates:
- "quay.io/lwolf/kube-cleanup-operator:{{ .Version }}-arm64"

docker_manifests:
- id: manifest-release
name_template: "quay.io/lwolf/kube-cleanup-operator:{{ .Version }}"
image_templates:
- "quay.io/lwolf/kube-cleanup-operator:{{ .Version }}-amd64"
- "quay.io/lwolf/kube-cleanup-operator:{{ .Version }}-arm64"

- id: manifest-latest
name_template: "quay.io/lwolf/kube-cleanup-operator:latest"
image_templates:
- "quay.io/lwolf/kube-cleanup-operator:{{ .Version }}-amd64"
- "quay.io/lwolf/kube-cleanup-operator:{{ .Version }}-arm64"

0 comments on commit 5daa877

Please sign in to comment.