Skip to content

Commit

Permalink
setup circleci and build util scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
xchapter7x committed Feb 23, 2019
1 parent 4394872 commit e1fb6e7
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Golang CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-go/ for more details
version: 2
jobs:
build:
docker:
- image: circleci/golang:latest
working_directory: /go/src/github.com/xchapter7x/clarity
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run: go get -u github.com/maxbrunsfeld/counterfeiter
- run: dep ensure
- run: make unit
- run: make build
- persist_to_workspace:
root: bin
paths:
- create_new_release.sh
- persist_to_workspace:
root: build
paths:
- clarity.exe
- clarity_osx
- clarity_unix
release:
docker:
- image: socialengine/github-release
working_directory: /go/src/github.com/xchapter7x/clarity
steps:
- attach_workspace:
at: bin
- attach_workspace:
at: build
- run: ./bin/create_new_release.sh
workflows:
version: 2
build-and-release:
jobs:
- build
- release:
requires:
- build
20 changes: 20 additions & 0 deletions bin/create_new_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash -x
echo "generate a rc build number"
github-release info | grep -A 20 "^git\ tags"
next_semver=`github-release info | grep -A 20 "^git\ tags" | grep "^-" | grep -v -e "-rc" | head -1 | awk '{print $2}' | awk -F"." '{print $1"."$2"."$3+1}'`
next_rc_version=`github-release info | grep -A 20 "^git\ tags" | grep "${next_semver}" | grep -e "-rc" | head -1 | awk -F"-rc." '{print $2+1}'`
if [[ "${next_rc_version/ /}" == "" ]]; then
echo "setting default base rc"
next_rc_version=0
fi
echo "next rc id is: "$next_rc_version
echo "generate a release tag for this RC"
tag=${next_semver}-rc.${next_rc_version}
echo "tag id is: "$tag
echo "creating release"
github-release release -t ${tag} -p
echo "uploading files"
for file in `ls build | grep '^clarity'`
do
github-release upload -t ${tag} -f build/${file} -n ${file}
done

0 comments on commit e1fb6e7

Please sign in to comment.