Skip to content

Commit

Permalink
Add script incrementing versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzysztof Reczek committed Dec 2, 2020
1 parent 6aba270 commit 090c172
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ jobs:
- run:
name: "Publish Release on GitHub"
command: |
. ./scripts/next_version.sh
VERSION=$(next_version $(git describe --tags --abbrev=0) 2)
go get github.com/tcnksm/ghr
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} v0.0.${CIRCLE_BUILD_NUM}
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${VERSION}
workflows:
version: 2
Expand Down
10 changes: 10 additions & 0 deletions scripts/next_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

next_version() {
local delimiter=.
local array=($(echo "$1" | tr $delimiter '\n'))
array[$2]=$((array[$2]+1))
if [ $2 -lt 2 ]; then array[2]=0; fi
if [ $2 -lt 1 ]; then array[1]=0; fi
echo $(local IFS=$delimiter ; echo "${array[*]}")
}

0 comments on commit 090c172

Please sign in to comment.