github.com/pulumi/terraform@v1.4.0/website/scripts/website-build.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 base project 9 PREVIEW_DIR=website-preview 10 # The directory we want to clone the project into 11 CLONE_DIR=website-preview 12 # The product for which we are building the deploy preview 13 PRODUCT=terraform 14 # Preview mode, controls the UI rendered (either the product site or developer). Can be `io` or `developer` 15 PREVIEW_MODE=developer 16 17 # Get the git branch of the commit that triggered the deploy preview 18 # This will power remote image assets in local and deploy previews 19 CURRENT_GIT_BRANCH=$VERCEL_GIT_COMMIT_REF 20 21 # This is where content files live, relative to the website-preview dir. If omitted, "../content" will be used 22 LOCAL_CONTENT_DIR=../docs 23 24 from_cache=false 25 26 if [ -d "$PREVIEW_DIR" ]; then 27 echo "$PREVIEW_DIR found" 28 CLONE_DIR="$PREVIEW_DIR-tmp" 29 from_cache=true 30 fi 31 32 # Clone the base project, if needed 33 echo "⏳ Cloning the $REPO_TO_CLONE repo, this might take a while..." 34 git clone --depth=1 "https://github.com/hashicorp/$REPO_TO_CLONE.git" "$CLONE_DIR" 35 36 if [ "$from_cache" = true ]; then 37 echo "Setting up $PREVIEW_DIR" 38 cp -R "./$CLONE_DIR/." "./$PREVIEW_DIR" 39 fi 40 41 # cd into the preview directory project 42 cd "$PREVIEW_DIR" 43 44 # Run the build:deploy-preview start script 45 PREVIEW_FROM_REPO=$PRODUCT \ 46 IS_CONTENT_PREVIEW=true \ 47 PREVIEW_MODE=$PREVIEW_MODE \ 48 REPO=$PRODUCT \ 49 HASHI_ENV=project-preview \ 50 LOCAL_CONTENT_DIR=$LOCAL_CONTENT_DIR \ 51 CURRENT_GIT_BRANCH=$CURRENT_GIT_BRANCH \ 52 npm run build:deploy-preview