Skip to content

Commit

Permalink
add compression to binaries
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Gee <[email protected]>
  • Loading branch information
rgee0 authored and alexellis committed Sep 9, 2024
1 parent 9d3d9e5 commit 5109a6f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["./bin/kubetrim*"]'
asset_paths: '["./uploads/*"]'
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SOURCE_DIRS = cmd pkg main.go
export GO111MODULE=on

.PHONY: all
all: gofmt test build dist hash
all: gofmt test build dist compress hash

.PHONY: build
build:
Expand All @@ -21,7 +21,10 @@ test:

.PHONY: dist
dist:
mkdir -p bin

mkdir -p bin/
mkdir -p uploads/
rm -rf bin/kubetrim*
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags $(LDFLAGS) -o bin/kubetrim
CGO_ENABLED=0 GOOS=darwin go build -ldflags $(LDFLAGS) -o bin/kubetrim-darwin
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -a -ldflags $(LDFLAGS) -o bin/kubetrim-darwin-arm64
Expand All @@ -30,4 +33,8 @@ dist:

.PHONY: hash
hash:
rm -rf bin/*.sha256 && ./hack/hashgen.sh
rm -rf uploads/*.sha256 && ./hack/hashgen.sh

.PHONY: compress
compress:
./hack/compress.sh
5 changes: 5 additions & 0 deletions hack/compress.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

cd bin

for f in kubetrim*; do tar -cvzf ../uploads/$f.tgz $f; done
5 changes: 4 additions & 1 deletion hack/hashgen.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/sh

for f in bin/kubetrim*; do shasum -a 256 $f > $f.sha256; done
cd bin

for f in kubetrim*; do shasum -a 256 $f > ../uploads/$f.sha256; done

0 comments on commit 5109a6f

Please sign in to comment.