Skip to content

Commit

Permalink
Replace complicated release procedure with goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
johanbrandhorst committed Dec 21, 2018
1 parent dce4c06 commit 583c27d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 127 deletions.
117 changes: 4 additions & 113 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,94 +76,14 @@ jobs:
command: 'bazel run //:buildifier_check ||
(echo "ERROR: Bazel files not formatted, please run \`bazel run :buildifier\`" >&2; exit 1)'
when: always
write_release_version:
docker:
- image: docker:git
working_directory: /src
steps:
- checkout
- run: git describe --tags --abbrev=0 > VERSION
- persist_to_workspace:
root: ./
paths:
- VERSION
build_linux_release:
docker:
- image: jfbrandhorst/grpc-gateway-build-env
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
environment:
CGO_ENABLED: "0"
GOOS: "linux"
GOARCH: "amd64"
steps:
- checkout
- run: mkdir -p release
- run: dep ensure --vendor-only
- run: |
VERSION=$(git describe --tags --abbrev=0)
go build -o ./release/protoc-gen-grpc-gateway-${VERSION}-linux-x86_64 ./protoc-gen-grpc-gateway/
- run: |
VERSION=$(git describe --tags --abbrev=0)
go build -o ./release/protoc-gen-swagger-${VERSION}-linux-x86_64 ./protoc-gen-swagger/
- persist_to_workspace:
root: ./
paths:
- release
build_darwin_release:
docker:
- image: jfbrandhorst/grpc-gateway-build-env
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
environment:
CGO_ENABLED: "0"
GOOS: "darwin"
GOARCH: "amd64"
steps:
- checkout
- run: mkdir -p release
- run: dep ensure --vendor-only
- run: |
VERSION=$(git describe --tags --abbrev=0)
go build -o ./release/protoc-gen-grpc-gateway-${VERSION}-darwin-x86_64 ./protoc-gen-grpc-gateway/
- run: |
VERSION=$(git describe --tags --abbrev=0)
go build -o ./release/protoc-gen-swagger-${VERSION}-darwin-x86_64 ./protoc-gen-swagger/
- persist_to_workspace:
root: ./
paths:
- release
build_windows_release:
release:
docker:
- image: jfbrandhorst/grpc-gateway-build-env
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
environment:
CGO_ENABLED: "0"
GOOS: "windows"
GOARCH: "amd64"
steps:
- checkout
- run: mkdir -p release
- run: dep ensure --vendor-only
- run: |
VERSION=$(git describe --tags --abbrev=0)
go build -o ./release/protoc-gen-grpc-gateway-${VERSION}-windows-x86_64.exe ./protoc-gen-grpc-gateway/
- run: |
VERSION=$(git describe --tags --abbrev=0)
go build -o ./release/protoc-gen-swagger-${VERSION}-windows-x86_64.exe ./protoc-gen-swagger/
- persist_to_workspace:
root: ./
paths:
- release
publish_github_release:
docker:
- image: cibuilds/github:0.10
steps:
- attach_workspace:
at: /workspace
- run:
name: "Publish Release on GitHub"
command: |
VERSION=$(cat /workspace/VERSION)
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} /workspace/release/
- run: curl -sL https://git.io/goreleaser | bash
workflows:
version: 2
all:
Expand All @@ -174,38 +94,9 @@ workflows:
- generate
- lint
- bazel
- write_release_version:
filters:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+$/
- build_linux_release:
filters:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+$/
- build_windows_release:
filters:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+$/
- build_darwin_release:
- release:
filters:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+$/
# - publish_github_release:
# requires:
# - write_release_version
# - build_linux_release
# - build_darwin_release
# - build_windows_release
# filters:
# branches:
# ignore: /.*/
# tags:
# only: /^v\d+\.\d+\.\d+$/
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
27 changes: 27 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
builds:
- main: ./protoc-gen-grpc-gateway/main.go
binary: protoc-gen-grpc-gateway
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- amd64
- main: ./protoc-gen-swagger/main.go
binary: protoc-gen-swagger
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- amd64
archive:
name_template: "{{ .Binary }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
format: binary
replacements:
amd64: x86_64
dist: _output
15 changes: 1 addition & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -180,20 +180,7 @@ examples: $(EXAMPLE_DEPSRCS) $(EXAMPLE_SVCSRCS) $(EXAMPLE_GWSRCS) $(EXAMPLE_SWAG
test: examples
go test -race $(PKG)/...
go test -race $(PKG)/examples/integration -args -network=unix -endpoint=test.sock
changelog:
docker run --rm \
--interactive \
--tty \
-e "CHANGELOG_GITHUB_TOKEN=${CHANGELOG_GITHUB_TOKEN}" \
-v "$(PWD):/usr/local/src/your-app" \
ferrarimarco/github-changelog-generator:1.14.3 \
-u grpc-ecosystem \
-p grpc-gateway \
--author \
--compare-link \
--github-site=https://grpc-ecosystem.github.io/grpc-gateway \
--unreleased-label "**Next release**" \
--future-release=v1.6.0

lint:
golint --set_exit_status $(PKG)/runtime
golint --set_exit_status $(PKG)/utilities/...
Expand Down

0 comments on commit 583c27d

Please sign in to comment.