Skip to content

Commit

Permalink
fix(package): build and release #150 fix and create HISTORY after rel…
Browse files Browse the repository at this point in the history
…ease.
  • Loading branch information
Dexus committed Oct 8, 2017
1 parent b58a0b2 commit e948217
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 14 deletions.
19 changes: 13 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,16 @@ matrix:
- OPENSSL_DIR=""
before_install:
- sudo apt-get install -y haveged
- if [ "$TRAVIS_BRANCH" == "master" ]; then
git clone "https://github.com/$TRAVIS_REPO_SLUG.git" "$TRAVIS_REPO_SLUG";
cd "$TRAVIS_REPO_SLUG";
git checkout -qf "$TRAVIS_COMMIT";
- |
if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" != "false" ]]; then
#git clone "https://github.com/$TRAVIS_REPO_SLUG.git" "$TRAVIS_REPO_SLUG";
#cd "$TRAVIS_REPO_SLUG";
( set -euo pipefail
if [[ "${TRAVIS_COMMIT}" != "$(git rev-parse HEAD)" ]]; then
echo "Commit $(git rev-parse HEAD) doesn't match expected commit ${TRAVIS_COMMIT}"
git checkout "${TRAVIS_COMMIT}"
fi
)
fi
before_script:
- npm prune
Expand All @@ -47,8 +53,9 @@ script:
- if [[ "$OPENSSL_DIR" != "" ]]; then "./bin/test_build_openssl.sh" ; fi
- npm run test
after_success:
- if [[ "$TRAVIS_NODE_VERSION" == "8" && "$TRAVIS_BRANCH" == "master" ]]; then npm run aftersuccess ; fi
- if [ "$TRAVIS_BRANCH" == "master" ]; then npm run semantic-release ; fi
- if [[ "$TRAVIS_NODE_VERSION" == "8" && "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then npm run aftersuccess ; fi
- if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then npm run semantic-release ; fi
- if [[ "$TRAVIS_NODE_VERSION" == "8" && "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then npm run aftersuccess -- -push ; fi
branches:
except:
- /^v\d+\.\d+\.\d+$/
31 changes: 23 additions & 8 deletions bin/aftersuccess.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
#!/bin/bash
set -e

OUTPUT=$(node "$(pwd)/bin/aftersuccess.js")
STATUS=$?
VAR_PUSH=0

if [[ "${STATUS}" == "0" ]]
for i in "$@" ; do
if [[ $i == "-push" ]] ; then
VAR_PUSH=1
break
fi
done

git config --global user.name "Dexus via TravisCI"
git config --global user.email "github@josef-froehle.de"
git config credential.helper "store --file=.git/credentials"
echo "https://$GH_TOKEN:@github.com" > .git/credentials
git checkout "$TRAVIS_BRANCH" || exit 0

if [[ "${VAR_PUSH}" == "1" ]]
then
OUTPUT=$(node "$(pwd)/bin/aftersuccess.js")
STATUS=$?
echo "${OUTPUT}"
fi

if [[ "${STATUS}" == "0" && "${VAR_PUSH}" == "1" ]]
then
git config --global user.name "Dexus via TravisCI"
git config --global user.email "github@josef-froehle.de"
git config credential.helper "store --file=.git/credentials"
echo "https://$GH_TOKEN:@github.com" > .git/credentials
git checkout "$TRAVIS_BRANCH"
sleep 10
npm run changelog
git add HISTORY.md
git commit -m "Update HISTORY.md via TravisCI" -m "[ci skip]"
Expand Down

0 comments on commit e948217

Please sign in to comment.