tools/Makefile
GnomeZworc 596df19371
All checks were successful
/ publish (push) Successful in 6m36s
e
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
2025-08-10 14:41:33 +02:00

28 lines
No EOL
901 B
Makefile

ARCH := amd64 arm64
OS := linux windows darwin
NAME := password
VERSION := $(shell git describe)
BUILD := $(shell git rev-parse HEAD)
LDFLAGS=-ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD}"
.PHONY: all build_password publish_password
all: build_password publish_password
build_password:
$(foreach GOOS, ${OS},\
$(foreach GOARCH, ${ARCH}, \
$(shell CGO_ENABLED=0 go build -v -o bin/${NAME} ./golang/cmd/passwordhash;cd bin/;[ "${GOOS}" = "windows" ] && mv ${NAME} ${NAME}.exe;tar czf ${NAME}_${GOOS}_${GOARCH}.tar.gz *;rm -f ${NAME} ${NAME}.exe) \
))
publish_password:
$(foreach GOOS, ${OS},\
$(foreach GOARCH, ${ARCH}, \
$(curl --user ${GITHUB_ACTOR}:${GITHUB_TOKEN} --upload-file bin/${NAME}_${GOOS}_${GOARCH}.tar.gz ${GITHUB_API_URL}/packages/${GITHUB_REPOSITORY}/generic/${NAME}/${VER}/${NAME}_${GOOS}_${GOARCH}.tar.gz) \
))
clean:
rm -rf bin
re: clean all