Skip to content

Commit 2ed832c

Browse files
authored
Merge pull request #285 from priley86/travis-fix
ensure master-dist retains Travis dist file commit history
2 parents 3a718a6 + 3827fc2 commit 2ed832c

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ node_js:
33
- '0.10'
44

55
before_install:
6-
- 'git checkout -B master' # Reconcile detached HEAD
6+
- 'git checkout -B $TRAVIS_BRANCH' # Reconcile detached HEAD
77
- 'npm install -g bower grunt-cli'
88

99
script:

scripts/publish.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,19 @@ git add dist --force
2121
git commit -m "Added files generated by Travis build"
2222

2323
# Push to releases branch
24+
EXISTING=`git ls-remote --heads https://github.com/"$TRAVIS_REPO_SLUG".git "$TRAVIS_BRANCH"-dist`
25+
2426
if [ -z "$TRAVIS_TAG" ]
2527
then
26-
git push upstream $TRAVIS_BRANCH:$TRAVIS_BRANCH-dist --force -v
28+
if [ -n "$EXISTING" ]
29+
then
30+
git fetch upstream $TRAVIS_BRANCH-dist:$TRAVIS_BRANCH-dist
31+
git checkout $TRAVIS_BRANCH-dist
32+
git merge -Xtheirs $TRAVIS_BRANCH --no-edit --ff
33+
git push upstream $TRAVIS_BRANCH-dist --force -v
34+
else
35+
git push upstream $TRAVIS_BRANCH:$TRAVIS_BRANCH-dist --force -v
36+
fi
2737
fi
2838

29-
exit $?
39+
exit $?

0 commit comments

Comments
 (0)