Skip to content

Commit eac4b0a

Browse files
Run go-makefile-maker and publish docker image to ghcr.io registry (#159)
1 parent 80ea330 commit eac4b0a

6 files changed

Lines changed: 82 additions & 7 deletions

File tree

.github/workflows/checks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
uses: actions/setup-go@v6
3030
with:
3131
check-latest: true
32-
go-version: 1.25.5
32+
go-version: 1.25.6
3333
- name: Run prepare make target
3434
run: make generate
3535
- name: Run golangci-lint

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
uses: actions/setup-go@v6
3333
with:
3434
check-latest: true
35-
go-version: 1.25.5
35+
go-version: 1.25.6
3636
- name: Run prepare make target
3737
run: make generate
3838
- name: Build all binaries
@@ -67,7 +67,7 @@ jobs:
6767
uses: actions/setup-go@v6
6868
with:
6969
check-latest: true
70-
go-version: 1.25.5
70+
go-version: 1.25.6
7171
- name: Run prepare make target
7272
run: make generate
7373
- name: Run tests and generate coverage report
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
################################################################################
2+
# This file is AUTOGENERATED with <https://github.com/sapcc/go-makefile-maker> #
3+
# Edit Makefile.maker.yaml instead. #
4+
################################################################################
5+
6+
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company
7+
# SPDX-License-Identifier: Apache-2.0
8+
9+
name: Container Registry GHCR
10+
"on":
11+
push:
12+
branches:
13+
- main
14+
workflow_dispatch: {}
15+
permissions:
16+
contents: read
17+
packages: write
18+
jobs:
19+
build-and-push-image:
20+
name: Push container to ghcr.io
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Check out code
24+
uses: actions/checkout@v6
25+
- name: Log in to the Container registry
26+
uses: docker/login-action@v3
27+
with:
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
registry: ghcr.io
30+
username: ${{ github.actor }}
31+
- name: Extract metadata (tags, labels) for Docker
32+
id: meta
33+
uses: docker/metadata-action@v5
34+
with:
35+
images: ghcr.io/${{ github.repository }}
36+
tags: |
37+
# https://github.com/docker/metadata-action#typeedge
38+
type=edge
39+
# https://github.com/docker/metadata-action#latest-tag
40+
type=raw,value=latest,enable={{is_default_branch}}
41+
# https://github.com/docker/metadata-action#typesemver
42+
type=semver,pattern={{raw}}
43+
type=semver,pattern=v{{major}}.{{minor}}
44+
type=semver,pattern=v{{major}}
45+
# https://github.com/docker/metadata-action#typesha
46+
type=sha,format=long
47+
- name: Set up QEMU
48+
uses: docker/setup-qemu-action@v3
49+
- name: Set up Docker Buildx
50+
uses: docker/setup-buildx-action@v3
51+
- name: Build and push Docker image
52+
uses: docker/build-push-action@v6
53+
with:
54+
context: .
55+
labels: ${{ steps.meta.outputs.labels }}
56+
platforms: linux/amd64,linux/arm64
57+
push: true
58+
tags: ${{ steps.meta.outputs.tags }}

.github/workflows/goreleaser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
uses: actions/setup-go@v6
2828
with:
2929
check-latest: true
30-
go-version: 1.25.5
30+
go-version: 1.25.6
3131
- name: Run prepare make target
3232
run: make generate
3333
- name: Install syft

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ generate: install-controller-gen
249249
@printf "\e[1;36m>> controller-gen\e[0m\n"
250250
@controller-gen crd rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
251251
@controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
252-
@controller-gen applyconfiguration paths="./..."
252+
@controller-gen applyconfiguration:headerFile="hack/boilerplate.go.txt" paths="./..."
253253

254254
run-golangci-lint: FORCE install-golangci-lint
255255
@printf "\e[1;36m>> golangci-lint\e[0m\n"
@@ -293,9 +293,9 @@ tidy-deps: FORCE
293293

294294
license-headers: FORCE install-addlicense
295295
@printf "\e[1;36m>> addlicense (for license headers on source code files)\e[0m\n"
296-
@printf "%s\0" $(patsubst $(shell awk '$$1 == "module" {print $$2}' go.mod)%,.%/*.go,$(shell go list ./...)) | $(XARGS) -0 -I{} bash -c 'year="$$(grep 'Copyright' {} | head -n1 | grep -E -o '"'"'[0-9]{4}(-[0-9]{4})?'"'"')"; if [[ -z "$$year" ]]; then year=$$(date +%Y); fi; gawk -i inplace '"'"'{if (display) {print} else {!/^\/\*/ && !/^\*/}}; {if (!display && $$0 ~ /^(package |$$)/) {display=1} else { }}'"'"' {}; addlicense -c "SAP SE or an SAP affiliate company" -s=only -y "$$year" -- {}; $(SED) -i '"'"'1s+// Copyright +// SPDX-FileCopyrightText: +'"'"' {}; '
296+
@printf "%s\0" $(patsubst $(shell awk '$$1 == "module" {print $$2}' go.mod)%,.%/*.go,$(shell go list ./...)) | $(XARGS) -0 -I{} bash -c 'year="$$(grep 'Copyright' {} | head -n1 | grep -E -o '"'"'[0-9]{4}(-[0-9]{4})?'"'"')"; if [[ -z "$$year" ]]; then year=$$(date +%Y); fi; gawk -i inplace '"'"'{if (display) {print} else {!/^\/\*/ && !/^\*/}}; {if (!display && $$0 ~ /^(package |$$)/) {display=1} else { }}'"'"' {}; addlicense -c "SAP SE or an SAP affiliate company and IronCore contributors" -s=only -y "$$year" -- {}; $(SED) -i '"'"'1s+// Copyright +// SPDX-FileCopyrightText: +'"'"' {}; '
297297
@printf "\e[1;36m>> reuse annotate (for license headers on other files)\e[0m\n"
298-
@reuse lint -j | jq -r '.non_compliant.missing_licensing_info[]' | grep -vw vendor | $(XARGS) reuse annotate -c 'SAP SE or an SAP affiliate company' -l Apache-2.0 --skip-unrecognised
298+
@reuse lint -j | jq -r '.non_compliant.missing_licensing_info[]' | grep -vw vendor | $(XARGS) reuse annotate -c 'SAP SE or an SAP affiliate company and IronCore contributors' -l Apache-2.0 --skip-unrecognised
299299
@printf "\e[1;36m>> reuse download --all\e[0m\n"
300300
@reuse download --all
301301
@printf "\e[1;35mPlease review the changes. If *.license files were generated, consider instructing go-makefile-maker to add overrides to REUSE.toml instead.\e[0m\n"

Makefile.maker.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ controllerGen:
1212
enabled: true
1313
crdOutputPath: config/crd/bases
1414
objectHeaderFile: hack/boilerplate.go.txt
15+
applyconfigurationHeaderFile: hack/boilerplate.go.txt
1516
rbacRoleName: manager-role
1617

1718
coverageTest:
1819
only: "/internal"
1920

2021
dockerfile:
22+
# Custom Dockerfile using Distroless base image
2123
enabled: false
2224

2325
golang:
@@ -32,7 +34,14 @@ golangciLint:
3234
goReleaser:
3335
createConfig: true
3436

37+
license:
38+
addHeaders: true
39+
checkDependencies: true
40+
copyright: 'SAP SE or an SAP affiliate company and IronCore contributors'
41+
spdx: Apache-2.0
42+
3543
reuse:
44+
# Custom REUSE.toml with minimal settings
3645
enabled: false
3746

3847
renovate:
@@ -55,6 +64,14 @@ githubWorkflow:
5564
enabled: true
5665
securityChecks:
5766
enabled: true
67+
pushContainerToGhcr:
68+
enabled: true
69+
platforms: "linux/amd64,linux/arm64"
70+
tagStrategy:
71+
- edge
72+
- latest
73+
- semver
74+
- sha
5875

5976
variables:
6077
GO_BUILDENV: 'CGO_ENABLED=0'

0 commit comments

Comments
 (0)