diff --git a/.gitignore b/.gitignore index cfae606..3b4bd9a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,8 +5,7 @@ *.so *.dylib -main -alicloud-vault +alicloud-vault-* # Test binary, built with `go test -c` *.test diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..75f8b38 --- /dev/null +++ b/Makefile @@ -0,0 +1,39 @@ +VERSION=$(shell git describe --tags --candidates=1 --dirty) +BUILD_FLAGS=-ldflags="-X main.Version=$(VERSION) -s -w" -trimpath +SRC=$(shell find . -name '*.go') + +.PHONY: binaries clean release install + +binaries: alicloud-vault-linux-amd64 alicloud-vault-linux-arm64 alicloud-vault-darwin-amd64 alicloud-vault-windows-386.exe alicloud-vault-freebsd-amd64 + +clean: + rm -f alicloud-vault alicloud-vault-linux-amd64 alicloud-vault-linux-arm64 alicloud-vault-darwin-amd64 alicloud-vault-darwin-amd64.dmg alicloud-vault-windows-386.exe alicloud-vault-freebsd-amd64 SHA256SUMS + +release: binaries alicloud-vault-darwin-amd64.dmg SHA256SUMS + @echo "\nTo update homebrew-cask run\n\n cask-repair -v $(shell echo $(VERSION) | sed 's/v\(.*\)/\1/') alicloud-vault\n" + +alicloud-vault-darwin-amd64: $(SRC) + GOOS=darwin GOARCH=amd64 go build $(BUILD_FLAGS) -o $@ . + +alicloud-vault-freebsd-amd64: $(SRC) + GOOS=freebsd GOARCH=amd64 go build $(BUILD_FLAGS) -o $@ . + +alicloud-vault-linux-amd64: $(SRC) + GOOS=linux GOARCH=amd64 go build $(BUILD_FLAGS) -o $@ . + +alicloud-vault-linux-arm64: $(SRC) + GOOS=linux GOARCH=arm64 go build $(BUILD_FLAGS) -o $@ . + +alicloud-vault-windows-386.exe: $(SRC) + GOOS=windows GOARCH=386 go build $(BUILD_FLAGS) -o $@ . + +alicloud-vault-darwin-amd64.dmg: alicloud-vault-darwin-amd64 + ./bin/create-dmg alicloud-vault-darwin-amd64 $@ + +SHA256SUMS: binaries alicloud-vault-darwin-amd64.dmg + shasum -a 256 alicloud-vault-freebsd-amd64 alicloud-vault-linux-amd64 alicloud-vault-linux-arm64 alicloud-vault-windows-386.exe alicloud-vault-darwin-amd64.dmg > $@ + +install: + rm -f alicloud-vault + go build $(BUILD_FLAGS) . + mv alicloud-vault ~/bin/ \ No newline at end of file diff --git a/go.mod b/go.mod index def28f0..4ffe688 100644 --- a/go.mod +++ b/go.mod @@ -3,13 +3,11 @@ module github.com/arafato/alicloud-vault go 1.13 require ( - github.com/99designs/aws-vault v4.5.1+incompatible github.com/99designs/keyring v1.1.4 github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect github.com/aliyun/alibaba-cloud-sdk-go v1.60.387 github.com/aliyun/aliyun-cli v0.0.0-20200227123359-7f5eadc5184b - github.com/aws/aws-sdk-go v1.29.14 github.com/go-ini/ini v1.52.0 // indirect github.com/hashicorp/terraform v0.12.21 github.com/mitchellh/go-homedir v1.1.0 diff --git a/go.sum b/go.sum index 1f43bb7..d0d047f 100644 --- a/go.sum +++ b/go.sum @@ -7,8 +7,6 @@ cloud.google.com/go v0.45.1 h1:lRi0CHyU+ytlvylOlFKKq0af6JncuyoRh1J+QJBqQx0= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -github.com/99designs/aws-vault v4.5.1+incompatible h1:VjWncFWraO5K5HTRo34YMq2MkpKYphZy5luMSe76pkg= -github.com/99designs/aws-vault v4.5.1+incompatible/go.mod h1:BKt7gBiUkiAOh7TP/c36gMpRJkIk5F8hStyQoWwC/Rw= github.com/99designs/keyring v1.1.4 h1:x0g0zQ9bQKgNsLo0XSXAy1H8Q1RG/td+5OXJt+Ci8b8= github.com/99designs/keyring v1.1.4/go.mod h1:657DQuMrBZRtuL/voxVyiyb6zpMehlm5vLB9Qwrv904= github.com/Azure/azure-sdk-for-go v35.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= @@ -72,8 +70,6 @@ github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.25.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.29.14 h1:NToqC5ZQ2RaxxSPp9szuQimWQWPG++ITwXbklq/FN7c= -github.com/aws/aws-sdk-go v1.29.14/go.mod h1:1KvfttTE3SPKMpo8g2c6jL3ZKfXtFvKscTgahTma5Xg= github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas=