#!/bin/bash ruby -e 'exit (ENV["TRAVIS_BRANCH"] && ENV["TRAVIS_BRANCH"].match(/v\d+\.\d+\.\d+/) ? 0 : 1)' if [[ $TRAVIS_PULL_REQUEST != "false" ]]; then echo "This is a pull request! not publishing!" exit 0 fi if [[ $? -ne 0 ]]; then echo "this branch is not a release branch, it does not start with 'v'" echo "not publishing to bower, npm, or rubygems" exit 0 fi set -e $PWD/bin/check-package-version DIST_DIR=active-model-adapter-dist ACTIVE_MODEL_ADAPTER_DIST_REPO="https://$GITHUB_USER:$GITHUB_AUTH_TOKEN@github.com/ember-data/active-model-adapter-dist.git" VERSION=$($PWD/bin/version) set +e git clone $ACTIVE_MODEL_ADAPTER_DIST_REPO $DIST_DIR 2>&1 > /dev/null cp dist/*.js $DIST_DIR cp dist/*.json $DIST_DIR cd $DIST_DIR # Check to see if tag exists git show-ref --tags | egrep -q "refs/tags/$VERSION$" if [[ $? -eq 0 ]]; then echo "tag already exists; not doing anything" exit 0 fi git config --local user.name "Tomster Automated Release" git config --local user.email "noreply@emberjs.com" git add active-model-adapter.js git add bower.json git commit -a -m "release ${VERSION}" git tag $VERSION # Prevent leaking of credentials git push origin master 2>&1 > /dev/null git push origin --tags 2>&1 > /dev/null