Skip to content

Commit 13d946a

Browse files
Replace complicated release procedure with goreleaser
1 parent dce4c06 commit 13d946a

File tree

2 files changed

+31
-113
lines changed

2 files changed

+31
-113
lines changed

.circleci/config.yml

Lines changed: 4 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -76,94 +76,14 @@ jobs:
7676
command: 'bazel run //:buildifier_check ||
7777
(echo "ERROR: Bazel files not formatted, please run \`bazel run :buildifier\`" >&2; exit 1)'
7878
when: always
79-
write_release_version:
80-
docker:
81-
- image: docker:git
82-
working_directory: /src
83-
steps:
84-
- checkout
85-
- run: git describe --tags --abbrev=0 > VERSION
86-
- persist_to_workspace:
87-
root: ./
88-
paths:
89-
- VERSION
90-
build_linux_release:
91-
docker:
92-
- image: jfbrandhorst/grpc-gateway-build-env
93-
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
94-
environment:
95-
CGO_ENABLED: "0"
96-
GOOS: "linux"
97-
GOARCH: "amd64"
98-
steps:
99-
- checkout
100-
- run: mkdir -p release
101-
- run: dep ensure --vendor-only
102-
- run: |
103-
VERSION=$(git describe --tags --abbrev=0)
104-
go build -o ./release/protoc-gen-grpc-gateway-${VERSION}-linux-x86_64 ./protoc-gen-grpc-gateway/
105-
- run: |
106-
VERSION=$(git describe --tags --abbrev=0)
107-
go build -o ./release/protoc-gen-swagger-${VERSION}-linux-x86_64 ./protoc-gen-swagger/
108-
- persist_to_workspace:
109-
root: ./
110-
paths:
111-
- release
112-
build_darwin_release:
113-
docker:
114-
- image: jfbrandhorst/grpc-gateway-build-env
115-
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
116-
environment:
117-
CGO_ENABLED: "0"
118-
GOOS: "darwin"
119-
GOARCH: "amd64"
120-
steps:
121-
- checkout
122-
- run: mkdir -p release
123-
- run: dep ensure --vendor-only
124-
- run: |
125-
VERSION=$(git describe --tags --abbrev=0)
126-
go build -o ./release/protoc-gen-grpc-gateway-${VERSION}-darwin-x86_64 ./protoc-gen-grpc-gateway/
127-
- run: |
128-
VERSION=$(git describe --tags --abbrev=0)
129-
go build -o ./release/protoc-gen-swagger-${VERSION}-darwin-x86_64 ./protoc-gen-swagger/
130-
- persist_to_workspace:
131-
root: ./
132-
paths:
133-
- release
134-
build_windows_release:
79+
release:
13580
docker:
13681
- image: jfbrandhorst/grpc-gateway-build-env
13782
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
138-
environment:
139-
CGO_ENABLED: "0"
140-
GOOS: "windows"
141-
GOARCH: "amd64"
14283
steps:
14384
- checkout
144-
- run: mkdir -p release
14585
- run: dep ensure --vendor-only
146-
- run: |
147-
VERSION=$(git describe --tags --abbrev=0)
148-
go build -o ./release/protoc-gen-grpc-gateway-${VERSION}-windows-x86_64.exe ./protoc-gen-grpc-gateway/
149-
- run: |
150-
VERSION=$(git describe --tags --abbrev=0)
151-
go build -o ./release/protoc-gen-swagger-${VERSION}-windows-x86_64.exe ./protoc-gen-swagger/
152-
- persist_to_workspace:
153-
root: ./
154-
paths:
155-
- release
156-
publish_github_release:
157-
docker:
158-
- image: cibuilds/github:0.10
159-
steps:
160-
- attach_workspace:
161-
at: /workspace
162-
- run:
163-
name: "Publish Release on GitHub"
164-
command: |
165-
VERSION=$(cat /workspace/VERSION)
166-
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} /workspace/release/
86+
- run: curl -sL https://git.io/goreleaser | bash
16787
workflows:
16888
version: 2
16989
all:
@@ -174,38 +94,9 @@ workflows:
17494
- generate
17595
- lint
17696
- bazel
177-
- write_release_version:
178-
filters:
179-
branches:
180-
ignore: /.*/
181-
tags:
182-
only: /^v\d+\.\d+\.\d+$/
183-
- build_linux_release:
184-
filters:
185-
branches:
186-
ignore: /.*/
187-
tags:
188-
only: /^v\d+\.\d+\.\d+$/
189-
- build_windows_release:
190-
filters:
191-
branches:
192-
ignore: /.*/
193-
tags:
194-
only: /^v\d+\.\d+\.\d+$/
195-
- build_darwin_release:
97+
- release:
19698
filters:
19799
branches:
198100
ignore: /.*/
199101
tags:
200-
only: /^v\d+\.\d+\.\d+$/
201-
# - publish_github_release:
202-
# requires:
203-
# - write_release_version
204-
# - build_linux_release
205-
# - build_darwin_release
206-
# - build_windows_release
207-
# filters:
208-
# branches:
209-
# ignore: /.*/
210-
# tags:
211-
# only: /^v\d+\.\d+\.\d+$/
102+
only: /v[0-9]+(\.[0-9]+)*(-.*)*/

.goreleaser.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
builds:
2+
- main: ./protoc-gen-grpc-gateway/main.go
3+
binary: protoc-gen-grpc-gateway
4+
env:
5+
- CGO_ENABLED=0
6+
goos:
7+
- linux
8+
- darwin
9+
- windows
10+
goarch:
11+
- amd64
12+
- main: ./protoc-gen-swagger/main.go
13+
binary: protoc-gen-swagger
14+
env:
15+
- CGO_ENABLED=0
16+
goos:
17+
- linux
18+
- darwin
19+
- windows
20+
goarch:
21+
- amd64
22+
archive:
23+
name_template: "{{ .Binary }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
24+
format: binary
25+
replacements:
26+
amd64: x86_64
27+
dist: _output

0 commit comments

Comments
 (0)