Skip to content

Commit

Permalink
package as zip
Browse files Browse the repository at this point in the history
Signed-off-by: Johan Siebens <[email protected]>
  • Loading branch information
jsiebens committed May 22, 2021
1 parent 489067f commit 2f2fa87
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
with:
fetch-depth: 1

- run: make test dist hash
- run: make test dist

- uses: skx/github-action-publish-binaries@master
env:
Expand Down
19 changes: 10 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ SHELL := bash
LDFLAGS := "-s -w"
.PHONY: all

.PHONY: %.zip
%.zip:
touch $@

.PHONY: test
test:
go test ./...
Expand All @@ -13,12 +17,9 @@ build:
.PHONY: dist
dist:
mkdir -p dist
GOOS=linux go build -ldflags $(LDFLAGS) -o dist/do-droplets
GOOS=darwin go build -ldflags $(LDFLAGS) -o dist/do-droplets-darwin
GOOS=linux GOARCH=arm GOARM=6 go build -ldflags $(LDFLAGS) -o dist/do-droplets-armhf
GOOS=linux GOARCH=arm64 go build -ldflags $(LDFLAGS) -o dist/do-droplets-arm64
GOOS=windows go build -ldflags $(LDFLAGS) -o dist/do-droplets.exe

.PHONY: hash
hash:
for f in dist/do-droplets*; do shasum -a 256 $$f > $$f.sha256; done
./scripts/dist.sh linux amd64
./scripts/dist.sh linux arm64
./scripts/dist.sh linux arm
./scripts/dist.sh darwin amd64
./scripts/dist.sh windows amd64
cd dist && shasum -a 256 *.zip > do-droplets_SHA256SUMS && cd ..
10 changes: 10 additions & 0 deletions scripts/dist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

suffix=""
if [ $1 == "windows" ]; then
suffix=".exe"
fi

GOOS=$1 GOARCH=$2 go build -ldflags "-s -w" -o "dist/do-droplets${suffix}"
zip -j dist/do-droplets_$1_$2.zip "dist/do-droplets${suffix}"
rm -rf "dist/do-droplets${suffix}"

0 comments on commit 2f2fa87

Please sign in to comment.