Skip to content

Commit

Permalink
Merge pull request #327 from sroze/automate_travis
Browse files Browse the repository at this point in the history
setup bower
  • Loading branch information
graingert authored Oct 7, 2016
2 parents 1647842 + 91ed5ad commit d667c02
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ language: node_js
node_js: 6
before_install:
- "sh -e /etc/init.d/xvfb start"
env:
global:
- ENCRYPTION_LABEL: 61bce606080b
- COMMIT_AUTHOR_EMAIL: '[email protected]'
before_script:
- "export DISPLAY=:99.0"
- until xwininfo -root > /dev/null 2>&1; do echo "waiting for xvfb"; done
cache:
directories:
- node_modules
script: ./make-bower-build.sh
Binary file added id_ed25519_nginfinite.enc
Binary file not shown.
47 changes: 47 additions & 0 deletions make-bower-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash
set -e # Exit with nonzero exit code if anything fails

SOURCE_BRANCH="master"
TARGET_BRANCH="master"

# Run only test cases if this is not a release
if [ -z "$TRAVIS_TAG" ]; then
echo "Skipping deploy; just doing a build and running test cases"
npm test
exit 0
fi

npm test

# Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in id_ed25519_nginfinite.enc -out deploy_key -d
chmod 600 deploy_key
eval `ssh-agent -s`
ssh-add deploy_key

BOWER_REPO='[email protected]:ng-infinite-scroll/ng-infinite-scroll-bower.git'

BOWER_REPO_DIR='out'
CWD="$PWD"

git clone $BOWER_REPO $BOWER_REPO_DIR
cd $BOWER_REPO_DIR
git checkout $TARGET_BRANCH || git checkout -b $TARGET_BRANCH

git config user.name "Travis CI"
git config user.email "$COMMIT_AUTHOR_EMAIL"

# Copy all build content to the bower repo
cp -r ../build .
cp -r ../src .

git add build
git add src

git commit -am "Release version $TRAVIS_TAG"
git tag "$TRAVIS_TAG"
git push origin $TARGET_BRANCH $TRAVIS_TAG

0 comments on commit d667c02

Please sign in to comment.