UNPKG

1.24 kBPlain TextView Raw
1#!/bin/bash
2
3ruby -e 'exit (ENV["TRAVIS_BRANCH"] && ENV["TRAVIS_BRANCH"].match(/v\d+\.\d+\.\d+/) ? 0 : 1)'
4
5if [[ $TRAVIS_PULL_REQUEST != "false" ]]; then
6 echo "This is a pull request! not publishing!"
7 exit 0
8fi
9
10if [[ $? -ne 0 ]]; then
11 echo "this branch is not a release branch, it does not start with 'v'"
12 echo "not publishing to bower, npm, or rubygems"
13 exit 0
14fi
15
16set -e
17
18$PWD/bin/check-package-version
19
20DIST_DIR=active-model-adapter-dist
21ACTIVE_MODEL_ADAPTER_DIST_REPO="https://$GITHUB_USER:$GITHUB_AUTH_TOKEN@github.com/ember-data/active-model-adapter-dist.git"
22VERSION=$($PWD/bin/version)
23
24set +e
25
26git clone $ACTIVE_MODEL_ADAPTER_DIST_REPO $DIST_DIR 2>&1 > /dev/null
27cp dist/*.js $DIST_DIR
28cp dist/*.json $DIST_DIR
29
30cd $DIST_DIR
31# Check to see if tag exists
32git show-ref --tags | egrep -q "refs/tags/$VERSION$"
33
34if [[ $? -eq 0 ]]; then
35 echo "tag already exists; not doing anything"
36 exit 0
37fi
38
39git config --local user.name "Tomster Automated Release"
40git config --local user.email "noreply@emberjs.com"
41git add active-model-adapter.js
42git add bower.json
43git commit -a -m "release ${VERSION}"
44git tag $VERSION
45
46# Prevent leaking of credentials
47git push origin master 2>&1 > /dev/null
48git push origin --tags 2>&1 > /dev/null