From d57ef181da911a543b8e5c7da7590acf0148bb57 Mon Sep 17 00:00:00 2001 From: Szymon Szypulski Date: Tue, 22 Nov 2022 07:50:54 +0100 Subject: [PATCH] Add support for the arm64 architecture It is for people trying to run an arm64-only infrastructure (for example, Gravitron). From my testing, we do not need any other changes. --- .goreleaser.yml | 3 ++- entrypoint.sh | 12 +++++++++++- scripts/build.sh | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 23ef6a3..c7e54e8 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -3,7 +3,7 @@ before: - go mod tidy - go mod vendor builds: - - + - id: commenter main: ./cmd/commenter binary: commenter @@ -14,6 +14,7 @@ builds: - linux goarch: - amd64 + - arm64 snapshot: name_template: "{{ .Tag }}-next" diff --git a/entrypoint.sh b/entrypoint.sh index 5849e49..df03ec3 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -32,9 +32,19 @@ function get_release_assets { } function install_release { + arch="" + case "$(uname -m)" in + "aarch64") + arch="arm64" + ;; + "x86_64") + arch="amd64" + ;; + esac + repo="$1" version="$2" - binary="$3-linux-amd64" + binary="$3-linux-$arch" checksum="$4" release_assets="$(get_release_assets "${repo}" "${version}")" diff --git a/scripts/build.sh b/scripts/build.sh index cd57bae..96c5b99 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -2,3 +2,4 @@ export GO111MODULE=auto GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o bin/commenter-linux-amd64 ./cmd/commenter +GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o bin/commenter-linux-arm64 ./cmd/commenter