Skip to content

Commit 01c07cd

Browse files
Write version to intermediate file for release publish
1 parent 66f0e34 commit 01c07cd

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

.circleci/config.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ 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
7990
build_linux_release:
8091
docker:
8192
- image: jfbrandhorst/grpc-gateway-build-env
@@ -147,13 +158,12 @@ jobs:
147158
- image: cibuilds/github:0.10
148159
steps:
149160
- attach_workspace:
150-
at: ./release
151-
- checkout
161+
at: /workspace
152162
- run:
153163
name: "Publish Release on GitHub"
154164
command: |
155-
VERSION=$(git describe --tags --abbrev=0)
156-
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${VERSION} ./release/
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/
157167
workflows:
158168
version: 2
159169
all:
@@ -164,6 +174,12 @@ workflows:
164174
- generate
165175
- lint
166176
- bazel
177+
- write_release_version:
178+
filters:
179+
branches:
180+
ignore: /.*/
181+
tags:
182+
only: /^v\d+\.\d+\.\d+$/
167183
- build_linux_release:
168184
filters:
169185
branches:
@@ -184,6 +200,7 @@ workflows:
184200
only: /^v\d+\.\d+\.\d+$/
185201
- publish_github_release:
186202
requires:
203+
- write_release_version
187204
- build_linux_release
188205
- build_darwin_release
189206
- build_windows_release

0 commit comments

Comments
 (0)