-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathdeploy.sh
executable file
·40 lines (33 loc) · 1.24 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
#!/bin/bash
# This script is responsible for deploying the build/ directory
# to the master branch on GitHub.
#
# GITHUB_TOKEN, RUNDECK_UPDATE_DOCS_JOB_URL and RUNDECK_TOKEN env
# vars have been provided through Travis web interface.
set -euo pipefail
TRAVIS_BRANCH=${TRAVIS_BRANCH:-''}
TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST:-'false'}
DEPLOY_REPOSITORY=${DEPLOY_REPOSITORY:-''}
GITHUB_TOKEN=${GITHUB_TOKEN:-''}
DEPLOY_BRANCH=${DEPLOY_BRANCH:-'master'}
DEPLOY_REPOSITORY=${DEPLOY_REPOSITORY:-https://[email protected]/cozy/cozy.github.io.git}
if [[ "$TRAVIS_BRANCH" != "dev" && $TRAVIS_BRANCH != '' ]]; then
echo "Not on dev (branch is $TRAVIS_BRANCH), aborting deploy"
exit 0
fi
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
echo "On pull request, aborting deploy"
exit 0
fi
if [[ "$GITHUB_TOKEN" == "" && $DEPLOY_REPOSITORY == '' ]]; then
echo "No GitHub token, aborting deploy"
exit 0
fi
echo "Deploying on $DEPLOY_BRANCH (dev branch is dev, org pages must be published on master)..."
yarn git-directory-deploy \
--username Cozy \
--email [email protected] \
--directory docs/ \
--repo=$DEPLOY_REPOSITORY \
--branch=$DEPLOY_BRANCH
echo "$DEPLOY_BRANCH branch updated. Should be visible on $(cat CNAME)"