From 46e6b35d3b74e1b96cd6cedc2aa367a8c6ce8461 Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 19 Mar 2019 18:16:07 +0100 Subject: [PATCH] Prettify releases (#9) * Prettify releases * Update readme --- .dockerignore | 1 + .drone.yml | 6 +++--- Dockerfile | 4 ++-- Makefile | 24 ++++++++++++++++++------ README.md | 10 +++++----- 5 files changed, 29 insertions(+), 16 deletions(-) diff --git a/.dockerignore b/.dockerignore index e660fd9..a5d8f72 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,2 @@ bin/ +dist/ diff --git a/.drone.yml b/.drone.yml index dfecace..a707f44 100644 --- a/.drone.yml +++ b/.drone.yml @@ -36,7 +36,7 @@ steps: - name: build-release image: golang:1.12 commands: - - make build + - make release environment: REVISION: "${DRONE_COMMIT}" VERSION: "${DRONE_TAG}" @@ -71,13 +71,13 @@ steps: - sha256 - sha512 files: - - "bin/release/*" + - "dist/*" when: event: - tag --- kind: signature -hmac: 901f0710cced99e0a6773ba2ad29e6bfaa825c20cb418a4b01262004c2212daf +hmac: 2820ac74026f750371398745d9e947db025b3a32dc5e0294bd99c339e281df1c ... diff --git a/Dockerfile b/Dockerfile index bb83b49..9dad3d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,12 +21,12 @@ RUN dpkg -i session-manager-plugin.deb FROM gcr.io/distroless/base:debug as debug COPY --from=build /usr/local/sessionmanagerplugin/bin/session-manager-plugin /usr/local/bin/ -COPY --from=build /go/src/app/bin/dev/sigil-linux /sigil +COPY --from=build /go/src/app/bin/dev/linux/amd64/sigil /sigil ENTRYPOINT [ "/sigil" ] CMD [ "--help" ] FROM gcr.io/distroless/base as prod COPY --from=build /usr/local/sessionmanagerplugin/bin/session-manager-plugin /usr/local/bin/ -COPY --from=build /go/src/app/bin/release/sigil-linux /sigil +COPY --from=build /go/src/app/bin/release/linux/amd64/sigil /sigil ENTRYPOINT [ "/sigil" ] CMD [ "--help" ] diff --git a/Makefile b/Makefile index 7753f08..ead89d7 100644 --- a/Makefile +++ b/Makefile @@ -19,25 +19,37 @@ build: bootstrap build-linux build-mac build-windows .PHONY: build-dev build: bootstrap build-linux-dev build-mac-dev build-windows-dev +.PHONY: release +release: build release-windows release-linux release-darwin + +release-windows: + @mkdir -p dist && tar -czvf dist/$(NAME)_windows-amd64.tar.gz -C bin/release/windows/amd64/ $(NAME).exe + +release-linux: + @mkdir -p dist && tar -czvf dist/$(NAME)_linux-amd64.tar.gz -C bin/release/linux/amd64/ $(NAME) + +release-darwin: + @mkdir -p dist && tar -czvf dist/$(NAME)_darwin-amd64.tar.gz -C bin/release/darwin/amd64/ $(NAME) + build-windows: export GOARCH=amd64 build-windows: @GOOS=windows go build -mod=vendor -v \ --ldflags="-w -X main.AppName=$(NAME) -X main.Version=$(VERSION) \ - -X main.Revision=$(REVISION)" -o bin/release/$(NAME)-windows cmd/$(NAME)/main.go + -X main.Revision=$(REVISION)" -o bin/release/windows/amd64/$(NAME).exe cmd/$(NAME)/main.go build-linux: export GOARCH=amd64 build-linux: export CGO_ENABLED=0 build-linux: @GOOS=linux go build -mod=vendor -v \ --ldflags="-w -X main.AppName=$(NAME) -X main.Version=$(VERSION) \ - -X main.Revision=$(REVISION)" -o bin/release/$(NAME)-linux cmd/$(NAME)/main.go + -X main.Revision=$(REVISION)" -o bin/release/linux/amd64/$(NAME) cmd/$(NAME)/main.go build-mac: export GOARCH=amd64 build-mac: export CGO_ENABLED=0 build-mac: @GOOS=darwin go build -mod=vendor -v \ --ldflags="-w -X main.AppName=$(NAME) -X main.Version=$(VERSION) \ - -X main.Revision=$(REVISION)" -o bin/release/$(NAME)-darwin cmd/$(NAME)/main.go + -X main.Revision=$(REVISION)" -o bin/release/darwin/amd64/$(NAME) cmd/$(NAME)/main.go build-docker: @docker build --build-arg VER=$(VERSION) --build-arg REV=$(REVISION) -t $(NAME):$(VERSION) . @@ -47,7 +59,7 @@ build-windows-dev: @GOOS=windows go build -mod=vendor -v \ --ldflags="-w -X main.LogLevel=debug -X main.AppName=$(NAME) \ -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \ - -o bin/dev/$(NAME)-windows cmd/$(NAME)/main.go + -o bin/dev/windows/amd64/$(NAME).exe cmd/$(NAME)/main.go build-linux-dev: export GOARCH=amd64 build-linux-dev: export CGO_ENABLED=0 @@ -55,7 +67,7 @@ build-linux-dev: @GOOS=linux go build -mod=vendor -v \ --ldflags="-w -X main.LogLevel=debug -X main.AppName=$(NAME) \ -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \ - -o bin/dev/$(NAME)-linux cmd/$(NAME)/main.go + -o bin/dev/linux/amd64/$(NAME) cmd/$(NAME)/main.go build-mac-dev: export GOARCH=amd64 build-mac-dev: export CGO_ENABLED=0 @@ -63,7 +75,7 @@ build-mac-dev: @GOOS=darwin go build -mod=vendor -v \ --ldflags="-w -X main.LogLevel=debug -X main.AppName=$(NAME) \ -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \ - -o bin/dev/$(NAME)-darwin cmd/$(NAME)/main.go + -o bin/dev/darwin/amd64/$(NAME) cmd/$(NAME)/main.go .PHONY: get-version get-version: diff --git a/README.md b/README.md index bd395c0..445bd47 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,9 @@ make build-[linux|mac|windows|docker] Binaries are located in: -- Linux: `dist/sigil-linux` -- Mac: `dist/sigil-darwin` -- Windows: `dist/sigil-windows` +- Linux: `bin/release/linux/amd64/sigil` +- Mac: `bin/release/darwin/amd64/sigil` +- Windows: `bin/release/darwin/amd64/sigil.exe` ### Docker @@ -47,11 +47,11 @@ docker run --rm -it -v ${HOME}/.sigil:/home/.sigil -v ${HOME}/.aws:/home/.aws da Binary: ```console -sigil-darwin -r eu-west-1 session --type instance-id --target i-xxxxxxxxxxxxxxxxx +sigil -r eu-west-1 session --type instance-id --target i-xxxxxxxxxxxxxxxxx ``` While using [aws-vault](https://github.com/99designs/aws-vault): ```console -aws-vault exec AWS_PROFILE -- sigil-darwin -r eu-west-1 session --type instance-id --target i-xxxxxxxxxxxxxxxxx +aws-vault exec AWS_PROFILE -- sigil -r eu-west-1 session --type instance-id --target i-xxxxxxxxxxxxxxxxx ```