From da0f964023c8a978fedb1ce99aec0b68a2787c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20SZKIBA?= Date: Fri, 26 Jul 2024 10:05:40 +0200 Subject: [PATCH] feat: build and deploy docker image to GitHub packages --- .goreleaser.yaml | 60 ++++++++++++++++++++++++++++++++++++++++++++++ releases/v0.1.2.md | 3 +++ 2 files changed, 63 insertions(+) create mode 100644 releases/v0.1.2.md diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 1481bb3..972bf0d 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,5 +1,7 @@ project_name: k6registry version: 2 +env: + - IMAGE_OWNER=ghcr.io/grafana before: hooks: - go mod tidy @@ -37,3 +39,61 @@ changelog: - "^chore:" - "^docs:" - "^test:" + +dockers: + - id: amd64 + dockerfile: Dockerfile.goreleaser + use: buildx + image_templates: + - "{{ .Env.IMAGE_OWNER }}/{{ .ProjectName }}:{{ .Tag }}-amd64" + - "{{ .Env.IMAGE_OWNER }}/{{ .ProjectName }}:v{{ .Major }}-amd64" + - "{{ .Env.IMAGE_OWNER }}/{{ .ProjectName }}:v{{ .Major }}.{{ .Minor }}-amd64" + - "{{ .Env.IMAGE_OWNER }}/{{ .ProjectName }}:latest-amd64" + + build_flag_templates: + - "--platform=linux/amd64" + - "--pull" + - "--label=org.opencontainers.image.created={{.Date}}" + - "--label=org.opencontainers.image.title={{.ProjectName}}" + - "--label=org.opencontainers.image.revision={{.FullCommit}}" + - "--label=org.opencontainers.image.version={{.Version}}" + - "--label=org.opencontainers.image.licenses=AGPL-3.0-only" + - id: arm64 + dockerfile: Dockerfile.goreleaser + use: buildx + image_templates: + - "{{ .Env.IMAGE_OWNER }}/{{ .ProjectName }}:{{ .Tag }}-arm64" + - "{{ .Env.IMAGE_OWNER }}/{{ .ProjectName }}:v{{ .Major }}-arm64" + - "{{ .Env.IMAGE_OWNER }}/{{ .ProjectName }}:v{{ .Major }}.{{ .Minor }}-arm64" + - "{{ .Env.IMAGE_OWNER }}/{{ .ProjectName }}:latest-arm64" + + build_flag_templates: + - "--platform=linux/arm64" + - "--pull" + - "--label=org.opencontainers.image.created={{.Date}}" + - "--label=org.opencontainers.image.title={{.ProjectName}}" + - "--label=org.opencontainers.image.revision={{.FullCommit}}" + - "--label=org.opencontainers.image.version={{.Version}}" + - "--label=org.opencontainers.image.licenses=AGPL-3.0-only" + +docker_manifests: + - id: tag + name_template: "{{ .Env.IMAGE_OWNER }}/{{ .ProjectName }}:{{ .Tag }}" + image_templates: + - "{{ .Env.IMAGE_OWNER }}/{{ .ProjectName }}:{{ .Tag }}-amd64" + - "{{ .Env.IMAGE_OWNER }}/{{ .ProjectName }}:{{ .Tag }}-arm64" + - id: major + name_template: "{{ .Env.IMAGE_OWNER }}/{{ .ProjectName }}:v{{ .Major }}" + image_templates: + - "{{ .Env.IMAGE_OWNER }}/{{ .ProjectName }}:v{{ .Major }}-amd64" + - "{{ .Env.IMAGE_OWNER }}/{{ .ProjectName }}:v{{ .Major }}-arm64" + - id: major-minor + name_template: "{{ .Env.IMAGE_OWNER }}/{{ .ProjectName }}:v{{ .Major }}.{{ .Minor }}" + image_templates: + - "{{ .Env.IMAGE_OWNER }}/{{ .ProjectName }}:v{{ .Major }}.{{ .Minor }}-amd64" + - "{{ .Env.IMAGE_OWNER }}/{{ .ProjectName }}:v{{ .Major }}.{{ .Minor }}-arm64" + - id: latest + name_template: "{{ .Env.IMAGE_OWNER }}/{{ .ProjectName }}:latest" + image_templates: + - "{{ .Env.IMAGE_OWNER }}/{{ .ProjectName }}:latest-amd64" + - "{{ .Env.IMAGE_OWNER }}/{{ .ProjectName }}:latest-arm64" diff --git a/releases/v0.1.2.md b/releases/v0.1.2.md new file mode 100644 index 0000000..bd41f87 --- /dev/null +++ b/releases/v0.1.2.md @@ -0,0 +1,3 @@ +k6registry `v0.1.2` is here 🎉! + +This is an internal maintenance release that build and publish Docker image to GitHub Packages.