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