error: [INFO] Deploy command invoked... Error: Error: Please set the GIT_USER environment variable, or explicitly specify USE_SSH instead!
93 lines
2.4 KiB
Bash
Executable File
93 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# ------------- Import some defaults for the shell
|
|
|
|
# Source shell defaults
|
|
# $0 is the currently running program (this file)
|
|
this_file_directory=$(dirname $0)
|
|
relative_path_to_defaults=$this_file_directory/../shell_defaults
|
|
|
|
# if a file exists there, source it. otherwise complain
|
|
if test -f $relative_path_to_defaults; then
|
|
# source and '.' are the same program
|
|
source $relative_path_to_defaults
|
|
else
|
|
echo -e "\033[31m\nFAILED TO SOURCE TEST RUNNING OPTIONS.\033[39m"
|
|
echo -e "\033[31mTried $relative_path_to_defaults\033[39m"
|
|
exit 1
|
|
fi
|
|
|
|
|
|
# ------------- Start Main
|
|
set +o xtrace
|
|
echo -e "$blue_text""This script pushes changes (somewhat pointlessly) to ""$default_text"
|
|
echo -e "$blue_text""airbyte's gh_pages branch\n""$default_text"
|
|
echo -e "$blue_text""It also actually deploys by copying those assets to""$default_text"
|
|
echo -e "$blue_text""the repo airbytehq/airbytehq.github.io\n\n""$default_text"
|
|
|
|
|
|
echo -e "$blue_text""Current path:""$default_text"
|
|
pwd
|
|
|
|
|
|
# Yarn check (which is commonly used to check for program existance)
|
|
if ! which yarn > /dev/null; then
|
|
echo -e "$red_text""yarn not found HALP!!\n\n""$default_text"
|
|
exit 1
|
|
fi
|
|
|
|
set -o xtrace
|
|
|
|
GIT_USER="octavia-squidington-iii"
|
|
|
|
cd docusaurus
|
|
pwd
|
|
|
|
# install packages
|
|
yarn install
|
|
|
|
# generate static content
|
|
yarn build
|
|
|
|
# write a prod website to airbytehq/airbyte gh_pages branch
|
|
yarn deploy
|
|
|
|
|
|
# Git makes more sense from /
|
|
cd ..
|
|
pwd
|
|
|
|
# We should be here but we are playing with fire
|
|
git fetch
|
|
# checkout the branch tracking it's remote
|
|
git switch gh-pages
|
|
|
|
# For tracking in the commit message
|
|
revision=$(git rev-parse --short HEAD)
|
|
|
|
# explained at length below
|
|
set +o xtrace
|
|
echo -e "$blue_text""Writing CNAME file!\n\n""$default_text"
|
|
set -o xtrace
|
|
|
|
# This is a weird one. GH Pages expects a CNAME file when redirecting
|
|
# we redirect docs.airbyte.io to airbytehq.github.io
|
|
# this tells github to expect docs.airbyte.com points to us
|
|
echo "docs.airbyte.com" > CNAME
|
|
|
|
git add CNAME
|
|
|
|
git commit --message "Adds CNAME to deploy for $revision"
|
|
|
|
# non functional. for debugging
|
|
git branch
|
|
|
|
# note that this is NOT airbyte repo
|
|
git push --force https://$GITHUB_TOKEN@github.com/airbytehq/airbytehq.github.io.git
|
|
|
|
# Want to push from your own computer? uncomment this line and comment out the push above
|
|
# git push --force https://git@github.com/airbytehq/airbytehq.github.io.git
|
|
|
|
set +o xtrace
|
|
echo -e "$blue_text""Script exiting 0 GREAT SUCCESS!!!?""$default_text"
|