github.com/pulumi/terraform@v1.4.0/website/scripts/website-start.sh (about) 1 ###################################################### 2 # NOTE: This file is managed by the Digital Team's # 3 # Terraform configuration @ hashicorp/mktg-terraform # 4 ###################################################### 5 6 # Repo which we are cloning and executing npm run build:deploy-preview within 7 REPO_TO_CLONE=dev-portal 8 # Set the subdirectory name for the dev-portal app 9 PREVIEW_DIR=website-preview 10 # The product for which we are building the deploy preview 11 PRODUCT=terraform 12 # Preview mode, controls the UI rendered (either the product site or developer). Can be `io` or `developer` 13 PREVIEW_MODE=developer 14 15 # Get the git branch of the commit that triggered the deploy preview 16 # This will power remote image assets in local and deploy previews 17 CURRENT_GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) 18 19 # This is where content files live, relative to the website-preview dir. If omitted, "../content" will be used 20 LOCAL_CONTENT_DIR=../docs 21 22 should_pull=true 23 24 # Clone the dev-portal project, if needed 25 if [ ! -d "$PREVIEW_DIR" ]; then 26 echo "⏳ Cloning the $REPO_TO_CLONE repo, this might take a while..." 27 git clone --depth=1 https://github.com/hashicorp/$REPO_TO_CLONE.git "$PREVIEW_DIR" 28 should_pull=false 29 fi 30 31 cd "$PREVIEW_DIR" 32 33 # If the directory already existed, pull to ensure the clone is fresh 34 if [ "$should_pull" = true ]; then 35 git pull origin main 36 fi 37 38 # Run the dev-portal content-repo start script 39 REPO=$PRODUCT \ 40 PREVIEW_FROM_REPO=$PRODUCT \ 41 LOCAL_CONTENT_DIR=$LOCAL_CONTENT_DIR \ 42 CURRENT_GIT_BRANCH=$CURRENT_GIT_BRANCH \ 43 PREVIEW_MODE=$PREVIEW_MODE \ 44 npm run start:local-preview