Skip to content

Commit

Permalink
Add publishing artifact
Browse files Browse the repository at this point in the history
Signed-off-by: Xabier Larrakoetxea <slok69@gmail.com>
  • Loading branch information
slok committed May 13, 2019
1 parent 5033f15 commit ee9f8da
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 7 deletions.
39 changes: 36 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
version: 2.1
jobs:
build:
test:
docker:
- image: circleci/golang:1.12
environment:
Expand All @@ -9,4 +9,37 @@ jobs:
working_directory: /go/src/github.com/slok/grafterm
steps:
- checkout
- run: make ci
- run: make ci

release:
docker:
- image: circleci/golang:1.12
environment:
GO111MODULE: "on"
GOPROXY: https://gocenter.io
working_directory: /go/src/github.com/slok/grafterm
steps:
- checkout
- run: make ci-release
- run:
name: "Publish Release on GitHub"
command: |
go get github.com/tcnksm/ghr
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${CIRCLE_TAG} ./bin/
workflows:
version: 2
main:
jobs:
- test:
filters:
tags:
only: /.*/
- release:
requires:
- test
filters:
branches:
ignore: /.*/
tags:
only: /^v.*/
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ MOCKS_CMD := ./hack/scripts/mockgen.sh
DOCKER_RUN_CMD := docker run --env ostype=$(OSTYPE) -v ${PWD}:$(DOCKER_GO_SERVICE_PATH) --rm -it $(SERVICE_NAME)
BUILD_BINARY_CMD := VERSION=${VERSION} ./hack/scripts/build.sh
BUILD_IMAGE_CMD := IMAGE_VERSION=${VERSION} ./hack/scripts/build-image.sh
CI_RELEASE_CMD := ./hack/scripts/travis-release.sh
CI_RELEASE_CMD := ./hack/scripts/ci-release.sh
DEPS_CMD := GO111MODULE=on go mod tidy && GO111MODULE=on go mod vendor


Expand Down
6 changes: 3 additions & 3 deletions hack/scripts/travis-release.sh → hack/scripts/ci-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

if [[ -n ${TRAVIS_TAG} ]]; then
echo "Tag ${TRAVIS_TAG}. building releases..."
if [[ -n ${CIRCLE_TAG} ]]; then
echo "Tag ${CIRCLE_TAG}. building releases..."

archs=( Linux Darwin Windows )
for arch in "${archs[@]}"
do
VERSION=${TRAVIS_TAG} ostype=${arch} ${current_dir}/build.sh
VERSION=${CIRCLE_TAG} ostype=${arch} ${current_dir}/build.sh
done
else
echo "no tag, skipping release..."
Expand Down

0 comments on commit ee9f8da

Please sign in to comment.