Skip to content

Commit 1bb99df

Browse files
committed
dist: provide src tarball with vendored deps
1 parent f74d56b commit 1bb99df

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
yubikey-touch-detector
22
dist
3+
vendor

Makefile

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,44 @@ GO_GCFLAGS := "all=-trimpath=${PWD}"
1010
GO_ASMFLAGS := "all=-trimpath=${PWD}"
1111
GO_LDFLAGS := "-extldflags ${LDFLAGS}"
1212

13+
.PHONY: local
14+
local: vendor build
15+
1316
.PHONY: build
1417
build: main.go detector/ notifier/
15-
go build -ldflags $(GO_LDFLAGS) -gcflags $(GO_GCFLAGS) -asmflags $(GO_ASMFLAGS) -o $(BIN) main.go
18+
go build -mod vendor -ldflags $(GO_LDFLAGS) -gcflags $(GO_GCFLAGS) -asmflags $(GO_ASMFLAGS) -o $(BIN) main.go
19+
20+
.PHONY: vendor
21+
vendor:
22+
go mod tidy
23+
go mod vendor
1624

1725
.PHONY: clean
1826
clean:
1927
rm -f "$(BIN)"
2028
rm -rf dist
29+
rm -rf vendor
2130

2231
.PHONY: dist
23-
dist: clean build
24-
mkdir -p dist
32+
dist: clean vendor build
33+
$(eval TMP := $(shell mktemp -d))
34+
mkdir "$(TMP)/$(BIN)-$(VERSION)"
35+
cp -r * "$(TMP)/$(BIN)-$(VERSION)"
36+
(cd "$(TMP)" && tar -cvzf "$(BIN)-$(VERSION)-src.tar.gz" "$(BIN)-$(VERSION)")
2537

26-
git archive -o "dist/$(BIN)-$(VERSION).tar.gz" --format tar.gz --prefix "$(BIN)-$(VERSION)/" "$(VERSION)"
38+
mkdir "$(TMP)/$(BIN)-$(VERSION)-linux64"
39+
cp "$(BIN)" "$(BIN).service" LICENSE README.md "$(TMP)/$(BIN)-$(VERSION)-linux64"
40+
(cd "$(TMP)" && tar -cvzf "$(BIN)-$(VERSION)-linux64.tar.gz" "$(BIN)-$(VERSION)-linux64")
2741

28-
tar -cvzf "dist/$(BIN)-$(VERSION)-linux64.tar.gz" "$(BIN)" "$(BIN).service" LICENSE README.md
42+
mkdir -p dist
43+
mv "$(TMP)/$(BIN)-$(VERSION)"-*.tar.gz dist
44+
git archive -o "dist/$(BIN)-$(VERSION).tar.gz" --format tar.gz --prefix "$(BIN)-$(VERSION)/" "$(VERSION)"
2945

3046
for file in dist/*; do \
3147
gpg --detach-sign --armor "$$file"; \
3248
done
3349

50+
rm -rf "$(TMP)"
3451
rm -f "dist/$(BIN)-$(VERSION).tar.gz"
3552

3653
.PHONY: install

0 commit comments

Comments
 (0)