Skip to content
This repository was archived by the owner on Sep 1, 2024. It is now read-only.

Commit 3e49c6e

Browse files
committed
only release gzipped files
1 parent 27859c4 commit 3e49c6e

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ jobs:
2525
prerelease: false
2626
files: |
2727
LICENSE.md
28-
target/openldap_exporter*
28+
target/*.gz

Makefile

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ GIT_TAG := $(shell git describe --tags 2>/dev/null)
33

44
LDFLAGS := -s -w -X github.com/tomcz/openldap_exporter.commit=${GITCOMMIT}
55
LDFLAGS := ${LDFLAGS} -X github.com/tomcz/openldap_exporter.tag=${GIT_TAG}
6+
OUTFILE ?= openldap_exporter
67

78
.PHONY: precommit
8-
precommit: clean format lint build
9+
precommit: clean format lint compile
910

1011
.PHONY: commit
11-
commit: clean build
12+
commit: clean cross-compile
13+
ls -lha target/
1214

1315
.PHONY: clean
1416
clean:
@@ -33,9 +35,14 @@ endif
3335
@echo "Running staticcheck ..."
3436
@staticcheck $(shell go list ./... | grep -v /vendor/)
3537

36-
compile = GOOS=$1 GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o target/openldap_exporter-$1 ./cmd/openldap_exporter
37-
38-
.PHONY: build
39-
build: target
40-
$(call compile,linux)
41-
$(call compile,darwin)
38+
.PHONY: compile
39+
compile: target
40+
go build -ldflags "${LDFLAGS}" -o target/${OUTFILE} ./cmd/openldap_exporter/...
41+
gzip -c < target/${OUTFILE} > target/${OUTFILE}.gz
42+
43+
.PHONY: cross-compile
44+
cross-compile:
45+
OUTFILE=openldap_exporter-linux-amd64 GOOS=linux GOARCH=amd64 $(MAKE) compile
46+
OUTFILE=openldap_exporter-linux-nocgo CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(MAKE) compile
47+
OUTFILE=openldap_exporter-osx-amd64 GOOS=darwin GOARCH=amd64 $(MAKE) compile
48+
OUTFILE=openldap_exporter-osx-arm64 GOOS=darwin GOARCH=arm64 $(MAKE) compile

0 commit comments

Comments
 (0)