Skip to content

Commit

Permalink
Write version to intermediate file for release publish
Browse files Browse the repository at this point in the history
  • Loading branch information
johanbrandhorst committed Dec 7, 2018
1 parent 66f0e34 commit 4366be0
Showing 1 changed file with 43 additions and 26 deletions.
69 changes: 43 additions & 26 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,26 @@ jobs:
- run:
name: Check that Bazel BUILD files are up-to-date
command: 'test -z "$(bazel run //:gazelle_diff)" ||
(echo "ERROR: Bazel files out-of-date, please run \`bazel run :gazelle_fix\`" >&2; exit 1)'
(echo "ERROR: Bazel files out-of-date, please run \`bazel run:gazelle_fix\`" >&2; exit 1)'
- run:
name: Run tests with Bazel
command: bazel test //...
- run:
name: Check formatting of Bazel BUILD files
command: 'bazel run //:buildifier_check ||
(echo "ERROR: Bazel files not formatted, please run \`bazel run :buildifier\`" >&2; exit 1)'
(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
Expand Down Expand Up @@ -147,13 +158,12 @@ jobs:
- image: cibuilds/github:0.10
steps:
- attach_workspace:
at: ./release
- checkout
at: /workspace
- run:
name: "Publish Release on GitHub"
command: |
VERSION=$(git describe --tags --abbrev=0)
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${VERSION} ./release/
VERSION=$(cat /workspace/VERSION)
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} /workspace/release/
workflows:
version: 2
all:
Expand All @@ -164,31 +174,38 @@ 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+$/
filters:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+$/
- build_windows_release:
filters:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+$/
filters:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+$/
- build_darwin_release:
filters:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+$/
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+$/
filters:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+$/

0 comments on commit 4366be0

Please sign in to comment.