-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.sh
44 lines (38 loc) · 1.41 KB
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
function bump {
echo "Configuring git..."
git config user.name "Travis CI"
git config user.email "[email protected]"
git config credential.helper "store --file=.git/credentials"
echo "https://${GH_TOKEN}:@github.com" > .git/credentials
echo "Bumping version..."
VERSION="$(npm version $1 --force -m 'Bump to version %s')"
COMMIT="$(git log -1)"
echo "Git commit: $COMMIT"
echo "Pushing version changes..."
git push origin HEAD:master --force
echo "Creating new release..."
API_JSON=$(printf '{"tag_name": "%s","target_commitish": "master","name": "%s","body": "Release of version %s","draft": false,"prerelease": false}' $VERSION $VERSION $VERSION)
curl --data "$API_JSON" https://api.github.com/repos/AdamWard1995/ember-online-status/releases?access_token=$GH_TOKEN
echo "Publishing to NPM..."
npm run ci-publish || true
exit 0
}
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_NODE_VERSION" = "6.11.0" ] && [ "$EMBER_TRY_SCENARIO" != "ember-default" ]; then
echo "Starting deployment process..."
if [[ $TRAVIS_COMMIT_MESSAGE == *"[ci patch]"* ]]; then
echo "Running patch release..."
bump "patch"
exit 1
fi
if [[ $TRAVIS_COMMIT_MESSAGE == *"[ci minor]"* ]]; then
echo "Running minor release..."
bump "minor"
exit 1
fi
if [[ $TRAVIS_COMMIT_MESSAGE == *"[ci major]"* ]]; then
echo "Running major release..."
bump "major"
exit 1
fi
fi