Skip to content

Commit

Permalink
Added make commands to create artifacts and upload them to a github r…
Browse files Browse the repository at this point in the history
…elease
  • Loading branch information
lonnblad committed Jul 17, 2020
1 parent daa36b6 commit 0add917
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,46 @@ cover:
go test -race -coverprofile=coverage.txt
go tool cover -html=coverage.txt
rm coverage.txt

ARTIFACT_DIR := _artifacts

# To upload artifacts for the current version;
# execute: make upload
#
# Check https://github.com/tcnksm/ghr for usage of ghr
upload: artifacts
ghr -replace $(VERS) $(ARTIFACT_DIR)

# To build artifacts for the current version;
# execute: make artifacts
#
# Supported OS - Platform combinations:
# darwin - amd64
# linux - amd64
artifacts: _artifacts_clean _artifacts_darwin_amd64 _artifacts_linux_amd64

_artifacts_clean:
rm -rf $(ARTIFACT_DIR)
mkdir $(ARTIFACT_DIR)

_artifacts_darwin_amd64: GOOS := darwin
_artifacts_darwin_amd64: GOARCH := amd64
_artifacts_darwin_amd64: DIR := godog-$(VERS)-$(GOOS)-$(GOARCH)
_artifacts_darwin_amd64:
mkdir $(ARTIFACT_DIR)/$(DIR)
env GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(ARTIFACT_DIR)/$(DIR)/godog ./cmd/godog
cp README.md $(ARTIFACT_DIR)/$(DIR)/README.md
cp LICENSE $(ARTIFACT_DIR)/$(DIR)/LICENSE
cd $(ARTIFACT_DIR) && tar -c --use-compress-program="pigz --fast" -f $(DIR).tar.gz $(DIR) && cd ..
rm -rf $(ARTIFACT_DIR)/$(DIR)

_artifacts_linux_amd64: GOOS := linux
_artifacts_linux_amd64: GOARCH := amd64
_artifacts_linux_amd64: DIR := godog-$(VERS)-$(GOOS)-$(GOARCH)
_artifacts_linux_amd64:
mkdir $(ARTIFACT_DIR)/$(DIR)
env GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(ARTIFACT_DIR)/$(DIR)/godog ./cmd/godog
cp README.md $(ARTIFACT_DIR)/$(DIR)/README.md
cp LICENSE $(ARTIFACT_DIR)/$(DIR)/LICENSE
cd $(ARTIFACT_DIR) && tar -c --use-compress-program="pigz --fast" -f $(DIR).tar.gz $(DIR) && cd ..
rm -rf $(ARTIFACT_DIR)/$(DIR)

0 comments on commit 0add917

Please sign in to comment.