-
Notifications
You must be signed in to change notification settings - Fork 7
/
deploy.sh
executable file
·23 lines (19 loc) · 1003 Bytes
/
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
#!/bin/sh
# Scripts to manage github pages deployment using a 'distribution' directory
# Ref: http://www.damian.oquanta.info/posts/one-line-deployment-of-your-site-to-gh-pages.html
# https://gist.github.com/cobyism/4730490
#
# This script assumes '${TARGET_DEPLOYMENT_BRANCH}' branch is the target deployment branch
# note: in the case of standard github pages, this is is 'gh-pages')
# note: in the case of a user github pages, this is is 'master')
# This script will deploy the CURRENT branch to the target branch
set -o
TARGET_DEPLOYMENT_BRANCH='gh-pages'
DISTRIBUTION_DIRECTORY='dist'
# Create the subtree
git subtree split --prefix ${DISTRIBUTION_DIRECTORY} -b ${TARGET_DEPLOYMENT_BRANCH}
# Becuase this is a 'force push' the branch must not be 'protected'
git push -f origin ${TARGET_DEPLOYMENT_BRANCH}:${TARGET_DEPLOYMENT_BRANCH}
# Remove the branch locally as its not needed.
# Deployment is simplified by re-creating the force pushing the branch
git branch -D ${TARGET_DEPLOYMENT_BRANCH}