File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ name : Release
3+
4+ on : # yamllint disable-line rule:truthy
5+ push :
6+ tags :
7+ - ' *'
8+
9+ jobs :
10+ build :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - uses : actions/checkout@v4
14+ with :
15+ fetch-depth : 1
16+ - name : Set up Go
17+ uses : actions/setup-go@v5
18+ with :
19+ go-version-file : go.mod
20+ - name : Install dependencies
21+ run : go mod download
22+ - name : Build
23+ run : make all
24+ - name : Create SHA256 checksum
25+ run : make checksum
26+ - name : Upload binaries and their SHA to Github Release
27+ uses : alexellis/upload-assets@0.4.0
28+ env :
29+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
30+ with :
31+ asset_paths : ' ["./bin/rpinfo*"]'
Original file line number Diff line number Diff line change 1+ Version := $(shell git describe --tags --dirty 2> /dev/null)
2+ GitCommit := $(shell git rev-parse HEAD)
3+ LDFLAGS := "-s -w -X github.com/tschaefer/rpinfo/version.Version=$(Version ) -X github.com/tschaefer/rpinfo/version.GitCommit=$(GitCommit ) "
4+
5+ .PHONY : all
6+ all : fmt lint dist
7+
8+ .PHONY : fmt
9+ fmt :
10+ test -z $(shell gofmt -l .) || (echo " [WARN] Fix format issues" && exit 1)
11+
12+ .PHONY : lint
13+ lint :
14+ test -z $(shell golangci-lint run >/dev/null || echo 1) || (echo " [WARN] Fix lint issues" && exit 1)
15+
16+ .PHONY : dist
17+ dist :
18+ mkdir -p bin
19+ CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o bin/rpinfo-arm64 -ldflags $(LDFLAGS ) .
20+ CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -o bin/rpinfo-armv5 -ldflags $(LDFLAGS ) .
21+ CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -o bin/rpinfo-armv6 -ldflags $(LDFLAGS ) .
22+ CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -o bin/rpinfo-armv7 -ldflags $(LDFLAGS ) .
23+
24+ .PHONY : checksum
25+ checksum :
26+ cd bin && \
27+ for f in rpinfo-arm64 rpinfo-armv5 rpinfo-armv6 rpinfo-armv7; do \
28+ sha256sum $$ f > $$ f.sha256; \
29+ done && \
30+ cd ..
31+
32+ .PHONY : clean
33+ clean :
34+ rm -rf bin
You can’t perform that action at this time.
0 commit comments