File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,12 +40,7 @@ before_deploy:
4040- if ! [ "$BEFORE_DEPLOY_RUN" ]; then
4141 export BEFORE_DEPLOY_RUN=1;
4242
43- git config --local user.name 'bugy';
44- git config --local user.email 'buggygm@gmail.com';
45- git tag -f 'dev';
46- git remote add gh https://${OWNER}:${GITHUB_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git;
47- git push -f gh dev;
48- git remote remove gh;
43+ tools/add_git_tag.sh
4944
5045 fi
5146deploy :
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ if [ -z " $TRAVIS_BRANCH " ] || [ -z " $OWNER " ] || [ -z " $GITHUB_TOKEN " ] || [ -z " $TRAVIS_REPO_SLUG " ]; then
4+ echo ' Some environment variables are not set'
5+ exit -1
6+ fi
7+
8+ if [ " $TRAVIS_BRANCH " == " master" ]; then
9+ export NEW_GIT_TAG=' dev'
10+
11+ elif [ " $TRAVIS_BRANCH " == " stable" ]; then
12+ last_tag=` git describe --abbrev=0 --tags`
13+ npm_tag=` grep -Po ' "version": "\d+.\d+.\d+"' web-src/package.json | grep -Po ' \d+.\d+.\d+' `
14+ minor_npm_version=${npm_tag% .* }
15+ if [ ${last_tag% .* } == " $minor_npm_version " ]; then
16+ patch_npm_version=${npm_tag##* .}
17+ next_patch_version=$(( patch_npm_version + 1 ))
18+ export NEW_GIT_TAG=" $minor_npm_version .$next_patch_version "
19+ else
20+ export NEW_GIT_TAG=" $npm_tag "
21+ fi
22+ fi
23+
24+ set -e
25+
26+ if [ -z " $NEW_GIT_TAG " ]; then
27+ echo ' Skipping tagging of branch' " $TRAVIS_BRANCH "
28+
29+ else
30+ git config --local user.name ' bugy' ;
31+ git config --local user.email ' buggygm@gmail.com' ;
32+ git tag -f " $NEW_GIT_TAG " ;
33+ git remote add gh https://${OWNER} :${GITHUB_TOKEN} @github.com/${TRAVIS_REPO_SLUG} .git;
34+ git push -f gh " $NEW_GIT_TAG " ;
35+ git remote remove gh;
36+ fi
Original file line number Diff line number Diff line change @@ -17,6 +17,11 @@ docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD"
1717
1818if [ " $TRAVIS_BRANCH " == " stable" ]; then
1919 docker tag " $IMAGE_NAME " :" $COMMIT " " $IMAGE_NAME " :latest
20+
21+ if [ ! -z " $NEW_GIT_TAG " ]; then
22+ docker tag " $IMAGE_NAME " :" $COMMIT " " $IMAGE_NAME " :" $NEW_GIT_TAG "
23+ fi
24+
2025elif [ " $TRAVIS_BRANCH " == " master" ]; then
2126 docker tag " $IMAGE_NAME " :" $COMMIT " " $IMAGE_NAME " :dev
2227else
You can’t perform that action at this time.
0 commit comments