File tree 3 files changed +42
-6
lines changed
3 files changed +42
-6
lines changed Original file line number Diff line number Diff line change @@ -40,12 +40,7 @@ before_deploy:
40
40
- if ! [ "$BEFORE_DEPLOY_RUN" ]; then
41
41
export BEFORE_DEPLOY_RUN=1;
42
42
43
- git config --local user.name 'bugy';
44
- git config --local user.email '[email protected] ';
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
49
44
50
45
fi
51
46
deploy :
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
' [email protected] ' ;
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"
17
17
18
18
if [ " $TRAVIS_BRANCH " == " stable" ]; then
19
19
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
+
20
25
elif [ " $TRAVIS_BRANCH " == " master" ]; then
21
26
docker tag " $IMAGE_NAME " :" $COMMIT " " $IMAGE_NAME " :dev
22
27
else
You can’t perform that action at this time.
0 commit comments