From 7a1cd103cdf4b2feeda49a0342f969bcb8db557a Mon Sep 17 00:00:00 2001 From: birdhimself Date: Fri, 15 May 2026 18:47:16 +0200 Subject: [PATCH] build: add arm64 support - build target outputs two binaries into /dist folder - pipeline uploads both binaries as artifacts + includes both in releases Refs: #5 --- .github/workflows/build.yml | 7 +++---- .gitignore | 2 +- Makefile | 13 ++++++++++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 69622cd..9f8fc8d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,9 +27,8 @@ jobs: - name: Upload Binary uses: actions/upload-artifact@v7 with: - name: compatdata-humanizer - path: compatdata-humanizer - archive: false + name: dist + path: dist/ release: needs: build @@ -41,7 +40,7 @@ jobs: - name: Download Artifact uses: actions/download-artifact@v8 with: - name: compatdata-humanizer + name: dist path: dist/ - name: Create GitHub Release diff --git a/.gitignore b/.gitignore index eb2056b..c744325 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Build output -/compatdata-humanizer +/dist # IDE/editor folders .idea diff --git a/Makefile b/Makefile index 129290e..efd9f22 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,17 @@ INSTALL_DIR = $(HOME)/.local/bin +DIST_DIR = dist BINARY = compatdata-humanizer +BINARY_AMD64 = $(BINARY).amd64 +BINARY_ARM64 = $(BINARY).arm64 VERSION := $(shell git tag --points-at HEAD | grep . || git rev-parse --short=8 HEAD) +OWN_ARCH := $(shell go env GOARCH) build: - go build \ - -ldflags "-s -X main.version=$(VERSION)" -o $(BINARY) \ + env GOOS=linux GOARCH=amd64 go build \ + -ldflags "-s -X main.version=$(VERSION)" -o "$(DIST_DIR)/$(BINARY_AMD64)" \ + ./cmd/compatdata-humanizer/compatdata-humanizer.go + env GOOS=linux GOARCH=arm64 go build \ + -ldflags "-s -X main.version=$(VERSION)" -o "$(DIST_DIR)/$(BINARY_ARM64)" \ ./cmd/compatdata-humanizer/compatdata-humanizer.go run: @@ -13,7 +20,7 @@ run: ./cmd/compatdata-humanizer/compatdata-humanizer.go install: build - cp $(BINARY) "$(INSTALL_DIR)" + cp "$(DIST_DIR)/$(BINARY).$(OWN_ARCH)" "$(INSTALL_DIR)/$(BINARY)" uninstall: rm "$(INSTALL_DIR)/$(BINARY)"