UNPKG

1.24 kBPlain TextView Raw
1#!/usr/bin/env bash
2set -o pipefail
3set -o errexit
4set -o nounset
5# set -o xtrace
6
7# Set magic variables for current file & dir
8__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
10__base="$(basename ${__file} .sh)"
11
12ghpages_repo=${GHPAGES_REPO:-"transloadit/uppy"}
13ghpages_branch=${GHPAGES_BRANCH:-"gh-pages"}
14ghpages_url=${GHPAGES_URL:-"git@github.com:${ghpages_repo}.git"}
15
16echo "--> Deploying to GitHub pages.."
17mkdir -p /tmp/deploy-${ghpages_repo}
18
19# Custom steps
20rsync \
21 --archive \
22 --delete \
23 --exclude=.git* \
24 --exclude=node_modules \
25 --exclude=lib \
26 --checksum \
27 --no-times \
28 --no-group \
29 --no-motd \
30 --no-owner \
31./website/public/ /tmp/deploy-${ghpages_repo} > /dev/null
32
33echo 'This branch is just a deploy target. Do not edit. You changes will be lost.' \
34 |tee /tmp/deploy-${ghpages_repo}/README.md
35
36(cd /tmp/deploy-${ghpages_repo} \
37 && git init && git checkout -B ${ghpages_branch} && git add --all . \
38 && git commit -nm "Update ${ghpages_repo} website by ${USER}" \
39 && (git remote add origin ${ghpages_url}|| true) \
40 && git push origin ${ghpages_branch}:refs/heads/${ghpages_branch} --force) > /dev/null
41
42rm -rf /tmp/deploy-${ghpages_repo}