From afc3abbed9d555d56829ccc69f87916838161702 Mon Sep 17 00:00:00 2001 From: Ardika Bagus Date: Fri, 3 Nov 2023 14:45:59 +0700 Subject: [PATCH] ci: add packaging as a form of container image Signed-off-by: Ardika Bagus --- .github/workflows/release.yaml | 16 +++++++++++- .goreleaser.yml | 45 ++++++++++++++++++++++++++++++++++ Dockerfile.goreleaser | 5 ++++ 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 Dockerfile.goreleaser diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 30c701a..cc37e7a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -3,10 +3,11 @@ name: Release on: push: tags: - - "*" + - "v*.*.*" permissions: contents: write + packages: write jobs: test: @@ -31,6 +32,19 @@ jobs: with: strip_v: true + - uses: docker/setup-qemu-action@v2 + + - uses: docker/setup-buildx-action@v2 + with: + endpoint: builders + + - name: Log in to the GitHub Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: diff --git a/.goreleaser.yml b/.goreleaser.yml index fc56246..14b1c86 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -41,3 +41,48 @@ release: owner: ardikabs name: helmize name_template: "Version {{.Version}}" + +dockers: + - goos: linux + goarch: amd64 + use: buildx + dockerfile: .goreleaser.Dockerfile + image_templates: + - "ghcr.io/ardikabs/helmize:latest-amd64" + - "ghcr.io/ardikabs/helmize:{{ .Major }}-amd64" + - "ghcr.io/ardikabs/helmize:{{ .Major }}.{{ .Minor }}-amd64" + - "ghcr.io/ardikabs/helmize:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-amd64" + build_flag_templates: + - "--builder=builders" + - "--platform=linux/amd64" + + - goos: linux + goarch: arm64 + use: buildx + dockerfile: .goreleaser.Dockerfile + image_templates: + - "ghcr.io/ardikabs/helmize:latest-amd64" + - "ghcr.io/ardikabs/helmize:{{ .Major }}-amd64" + - "ghcr.io/ardikabs/helmize:{{ .Major }}.{{ .Minor }}-amd64" + - "ghcr.io/ardikabs/helmize:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-amd64" + build_flag_templates: + - "--builder=builders" + - "--platform=linux/arm64" + +docker_manifests: + - name_template: ghcr.io/ardikabs/helmize:latest + image_templates: + - ghcr.io/ardikabs/helmize:latest-amd64 + - ghcr.io/ardikabs/helmize:latest-arm64 + - name_template: ghcr.io/ardikabs/helmize:v{{ .Major }} + image_templates: + - ghcr.io/ardikabs/helmize:{{ .Major }}-amd64 + - ghcr.io/ardikabs/helmize:{{ .Major }}-arm64 + - name_template: ghcr.io/ardikabs/helmize:v{{ .Major }}.{{ .Minor }} + image_templates: + - ghcr.io/ardikabs/helmize:{{ .Major }}.{{ .Minor }}-amd64 + - ghcr.io/ardikabs/helmize:{{ .Major }}.{{ .Minor }}-arm64 + - name_template: ghcr.io/ardikabs/helmize:v{{ .Major }}.{{ .Minor }}.{{ .Patch }} + image_templates: + - ghcr.io/ardikabs/helmize:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-amd64 + - ghcr.io/ardikabs/helmize:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-arm64 diff --git a/Dockerfile.goreleaser b/Dockerfile.goreleaser new file mode 100644 index 0000000..017a58b --- /dev/null +++ b/Dockerfile.goreleaser @@ -0,0 +1,5 @@ +FROM ghcr.io/ardikabs/etc/shell + +USER nobody +COPY helmize /usr/bin/helmize +CMD ["/usr/bin/helmize"] \ No newline at end of file