Add multi-arch builds
All checks were successful
Build and Publish / release (push) Successful in 2m21s

This commit is contained in:
2024-12-31 21:16:05 -05:00
parent f14bc47c7b
commit 30c65042dd
2 changed files with 30 additions and 13 deletions

View File

@ -3,6 +3,9 @@ CMD_NAME := git-project-manager
.PHONY: all test build install docs clean
VERSION ?= development # Default to "development" if VERSION is not set
PLATFORMS := linux/amd64 linux/arm64 darwin/amd64 darwin/arm64
OUTPUT_DIR := bin
PKG := gitea.libretechconsulting.com/rmcguire/git-project-manager
all: test build install docs
@ -10,10 +13,18 @@ test:
go test -v ./...
build: test
go build -ldflags "-X gitea.libretechconsulting.com/rmcguire/git-project-manager/cmd.Version=$(VERSION)" -o bin/${CMD_NAME}
@echo "Building for platforms: $(PLATFORMS)"
@for platform in $(PLATFORMS); do \
OS=$$(echo $$platform | cut -d/ -f1); \
ARCH=$$(echo $$platform | cut -d/ -f2); \
OUTPUT="$(OUTPUT_DIR)/$(CMD_NAME)-$$OS-$$ARCH"; \
GOOS=$$OS GOARCH=$$ARCH go build -ldflags "-X $(PKG)/cmd.Version=$(VERSION)" -o $$OUTPUT; \
echo "Built $$OUTPUT"; \
done
go build -ldflags "-X $(PKG)/cmd.Version=$(VERSION)" -o bin/${CMD_NAME}
install:
go install -v -ldflags "-X gitea.libretechconsulting.com/rmcguire/git-project-manager/cmd.Version=$(VERSION)" .
go install -v -ldflags "-X $(PKG)/cmd.Version=$(VERSION)" .
docs:
bin/${CMD_NAME} docs md