-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-staging
executable file
·40 lines (32 loc) · 1.04 KB
/
deploy-staging
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
#!/usr/bin/env bash
# set -xe
set -e
APP_DIR=$(cd $(dirname "${BASH_SOURCE[0]}")/.. && pwd)
GIT_REPO="https://github.com/substrate-developer-hub/substrate-developer-hub.github.io.git"
PROJECT_BUILD_DIR="build/substrate-developer-hub.github.io"
HTPASSWD='parity-devEx:$apr1$P.1bMHSB$u2PQ7KitD5aNk371vsQB0/'
HTACCESS="AuthUserFile /app/.htpasswd\n
AuthType Basic\n
AuthName \"Restricted Access\"\n
Require valid-user"
# cmd for building
echo $APP_DIR
pushd $APP_DIR > /dev/null
cd website
rm -rf $PROJECT_BUILD_DIR
yarn install
NODE_ENV=staging GIT_REV=`git rev-parse --short HEAD` yarn build
# Heroku will pick up from `staging` branch
cd $PROJECT_BUILD_DIR
git init .
git remote add origin $GIT_REPO
git checkout -b staging
# Adding necessary files for using heroku php buildpack
echo '<?php header("Location: /index.html");?>' > index.php
echo $HTPASSWD > .htpasswd
echo -e $HTACCESS > .htaccess
# Everything need to be done locally should be completed by this point. Push to upstream.
git add .
git commit -m "Updated"
git push -f origin staging
popd