1
0
mirror of https://github.com/strongdm/comply synced 2024-12-23 14:07:34 +00:00
comply/Makefile

133 lines
4.8 KiB
Makefile
Raw Normal View History

2018-05-15 21:13:11 +00:00
.DEFAULT_GOAL := comply
GO_SOURCES := $(shell find . -name '*.go')
THEME_SOURCES := $(shell find themes)
assets: $(THEME_SOURCES)
2019-07-14 16:51:10 +00:00
go install -mod=vendor github.com/containous/go-bindata/go-bindata
go install -mod=vendor github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs
go-bindata-assetfs -pkg theme -prefix themes themes/...
mv bindata.go internal/theme/themes_bindata.go
2018-05-15 21:13:11 +00:00
comply: assets $(GO_SOURCES)
@# $(eval VERSION := $(shell git describe --tags --always --dirty="-dev"))
@# $(eval LDFLAGS := -ldflags='-X "github.com/strongdm/comply/internal/cli.Version=$(VERSION)"')
go build $(LDFLAGS) github.com/strongdm/comply
dist: clean
$(eval VERSION := $(shell git describe --tags --always --dirty="-dev"))
$(eval LDFLAGS := -ldflags='-X "github.com/strongdm/comply/internal/cli.Version=$(VERSION)"')
mkdir dist
echo $(VERSION)
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -gcflags=-trimpath=$(GOPATH) -asmflags=-trimpath=$(GOPATH) -ldflags '-extldflags "-static"' $(LDFLAGS) -o dist/comply-$(VERSION)-darwin-amd64 .
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -gcflags=-trimpath=$(GOPATH) -asmflags=-trimpath=$(GOPATH) -ldflags '-extldflags "-static"' $(LDFLAGS) -o dist/comply-$(VERSION)-linux-amd64 .
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -gcflags=-trimpath=$(GOPATH) -asmflags=-trimpath=$(GOPATH) -ldflags '-extldflags "-static"' $(LDFLAGS) -o dist/comply-$(VERSION)-windows-amd64.exe .
2018-05-15 21:13:11 +00:00
cd dist && tar -czvf comply-$(VERSION)-darwin-amd64.tgz comply-$(VERSION)-darwin-amd64
cd dist && tar -czvf comply-$(VERSION)-linux-amd64.tgz comply-$(VERSION)-linux-amd64
cd dist && zip comply-$(VERSION)-windows-amd64.zip comply-$(VERSION)-windows-amd64.exe
2018-05-15 21:13:11 +00:00
brew: clean $(GO_SOURCES)
2018-05-15 21:13:11 +00:00
$(eval VERSION := $(shell cat version))
$(eval LDFLAGS := -ldflags='-X "github.com/strongdm/comply/internal/cli.Version=$(VERSION)"')
mkdir bin
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -gcflags=-trimpath=$(GOPATH) -asmflags=-trimpath=$(GOPATH) $(LDFLAGS) -o bin/comply .
clean:
rm -rf bin
rm -rf dist
rm -f comply
install: assets $(GO_SOURCES)
go install github.com/strongdm/comply
2018-12-17 22:51:07 +00:00
push-assets: is-clean assets
2018-05-15 21:13:11 +00:00
git commit -am "automated asset refresh (via Makefile)"
git push
is-clean:
ifeq ($(strip $(shell git status --porcelain 2>/dev/null)),)
# good to proceed
else
@echo working directory must be clean to proceed
@exit 1
endif
docker:
cd build && docker build -t strongdm/pandoc .
docker push strongdm/pandoc
cleanse:
git checkout --orphan newbranch
git add -A
git commit -m "Initial commit"
git branch -D master
git branch -m master
git push -f origin master
git gc --aggressive --prune=all
release-env:
ifndef GH_LOGIN
$(error GH_LOGIN must be set to a valid GitHub token)
endif
2018-05-18 23:48:25 +00:00
ifndef COMPLY_TAPDIR
$(error COMPLY_TAPDIR must be set to the path of the comply homebrew tap repo)
endif
2018-05-15 21:13:11 +00:00
release: release-env dist release-deps
$(eval VERSION := $(shell git describe --tags --always --dirty="-dev"))
github-release release \
--security-token $$GH_LOGIN \
--user strongdm \
--repo comply \
--tag $(VERSION) \
--name $(VERSION)
github-release upload \
--security-token $$GH_LOGIN \
--user strongdm \
--repo comply \
--tag $(VERSION) \
--name comply-$(VERSION)-darwin-amd64.tgz \
--file dist/comply-$(VERSION)-darwin-amd64.tgz
github-release upload \
--security-token $$GH_LOGIN \
--user strongdm \
--repo comply \
--tag $(VERSION) \
--name comply-$(VERSION)-linux-amd64.tgz \
--file dist/comply-$(VERSION)-linux-amd64.tgz
2018-05-16 23:51:51 +00:00
@echo "Update homebrew formula with the following: "
2018-05-18 23:48:25 +00:00
$(eval SHA := $(shell curl -s -L https://github.com/strongdm/comply/archive/$(VERSION).tar.gz |shasum -a 256|cut -d" " -f1))
2018-05-18 23:43:56 +00:00
@echo "version $(VERSION) sha $(SHA)"
2018-05-18 23:48:25 +00:00
cd $$COMPLY_TAPDIR && ./update.sh $(VERSION) $(SHA)
2018-05-18 18:36:34 +00:00
2019-03-16 07:04:55 +00:00
patch-release: release-env patch release
2018-05-18 18:36:34 +00:00
$(eval VERSION := $(shell git describe --tags --always --dirty="-dev"))
curl -X POST --data-urlencode 'payload={"channel": "#release", "username": "release", "text": "comply $(VERSION) released", "icon_emoji": ":shipit:"}' https://hooks.slack.com/services/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
2018-05-15 21:13:11 +00:00
2019-03-16 07:04:55 +00:00
minor-release: release-env minor release
$(eval VERSION := $(shell git describe --tags --always --dirty="-dev"))
curl -X POST --data-urlencode 'payload={"channel": "#release", "username": "release", "text": "comply $(VERSION) released", "icon_emoji": ":shipit:"}' https://hooks.slack.com/services/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
2018-05-15 21:13:11 +00:00
2019-03-16 07:20:46 +00:00
docker-release:
docker build --build-arg COMPLY_VERSION=`cat VERSION` -t strongdm/comply .
2019-03-16 07:28:08 +00:00
docker push strongdm/comply
2019-03-16 07:20:46 +00:00
2018-05-15 21:13:11 +00:00
patch: clean gitsem
2018-05-16 23:47:14 +00:00
gitsem -m "increment patch for release (via Makefile)" patch
2018-05-15 21:13:11 +00:00
git push
git push origin --tags
minor: clean gitsem
2018-05-16 23:47:14 +00:00
gitsem -m "increment minor for release (via Makefile)" minor
2018-05-15 21:13:11 +00:00
git push
git push origin --tags
release-deps: gitsem gh-release
gitsem:
2019-07-14 16:51:10 +00:00
go install github.com/Clever/gitsem
2018-05-15 21:13:11 +00:00
gh-release:
2019-07-14 16:51:10 +00:00
go install github.com/aktau/github-release