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 b2b68f0
Showing 1 changed file with 49 additions and 30 deletions.
79 changes: 49 additions & 30 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ 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: /go/src/github.com/grpc-ecosystem/grpc-gateway
steps:
- checkout
- run: mkdir -p release
- run: git describe --tags --abbrev=0 > ./release/VERSION
- persist_to_workspace:
root: .
paths:
- release
build_linux_release:
docker:
- image: jfbrandhorst/grpc-gateway-build-env
Expand All @@ -95,7 +107,7 @@ jobs:
VERSION=$(git describe --tags --abbrev=0)
go build -o ./release/protoc-gen-swagger-${VERSION}-linux-x86_64 ./protoc-gen-swagger/
- persist_to_workspace:
root: ./
root: .
paths:
- release
build_darwin_release:
Expand All @@ -117,7 +129,7 @@ jobs:
VERSION=$(git describe --tags --abbrev=0)
go build -o ./release/protoc-gen-swagger-${VERSION}-darwin-x86_64 ./protoc-gen-swagger/
- persist_to_workspace:
root: ./
root: .
paths:
- release
build_windows_release:
Expand All @@ -139,21 +151,21 @@ jobs:
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: ./
root: .
paths:
- release
publish_github_release:
docker:
- image: cibuilds/github:0.10
steps:
- attach_workspace:
at: ./release
- checkout
at: /workspace
- run: mv /workspace/release/VERSION /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 +176,38 @@ workflows:
- generate
- lint
- bazel
- 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:
filters:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+$/
- 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 #:
# 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 b2b68f0

Please sign in to comment.