Skip to content

Commit

Permalink
Add Makefile for common tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
yamaszone committed Jul 13, 2021
1 parent 6b963dd commit a7ac537
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version:
test -n "$(VERSION)" # $$VERSION must be set.

github-token:
test -n "$(GITHUB_TOKEN)" # $$GITHUB_TOKEN must be set.

fetch:
go get \
github.com/mitchellh/gox \
github.com/aktau/github-release

clean:
rm -rf ./release

build: version
gox -verbose \
-osarch="windows/amd64 linux/amd64 darwin/amd64" \
-output="release/{{.Dir}}-${VERSION}-{{.OS}}-{{.Arch}}" .

test:
go clean -testcache
go test ./...

publish: version github-token clean test build
github-release release --user yamaszone --repo gcp-secret-manager-buddy --tag ${VERSION} \
--name "${VERSION}" --description "${VERSION}" && \
github-release upload --user yamaszone --repo gcp-secret-manager-buddy --tag ${VERSION} \
--name "gcp-secret-manager-buddy-${VERSION}-windows-amd64.exe" --file release/gcp-secret-manager-buddy-${VERSION}-windows-amd64.exe; \
github-release upload --user yamaszone --repo gcp-secret-manager-buddy --tag ${VERSION} \
--name "gcp-secret-manager-buddy-${VERSION}-windows-amd64.exe.asc" --file release/gcp-secret-manager-buddy-${VERSION}-windows-amd64.exe.asc; \
for qualifier in darwin-amd64 linux-amd64 ; do \
github-release upload --user yamaszone --repo gcp-secret-manager-buddy --tag ${VERSION} \
--name "gcp-secret-manager-buddy-${VERSION}-$$qualifier" --file release/gcp-secret-manager-buddy-${VERSION}-$$qualifier; \
github-release upload --user yamaszone --repo gcp-secret-manager-buddy --tag ${VERSION} \
--name "gcp-secret-manager-buddy-${VERSION}-$$qualifier.asc" --file release/gcp-secret-manager-buddy-${VERSION}-$$qualifier.asc; \
done

0 comments on commit a7ac537

Please sign in to comment.