github.com/kanishk98/terraform@v1.3.0-dev.0.20220917174235-661ca8088a6a/website/scripts/website-build.sh (about)

     1  # Repo which we are cloning and executing npm run build:deploy-preview within
     2  REPO_TO_CLONE=terraform-website
     3  # Set the subdirectory name for the terraform-website app
     4  PREVIEW_DIR=website-preview
     5  CLONE_DIR=website-preview
     6  # Get the git branch of the commit that triggered the deploy preview
     7  # - https://vercel.com/docs/concepts/projects/environment-variables#system-environment-variables
     8  # This will power remote image assets in local and deploy previews
     9  CURRENT_GIT_BRANCH=$VERCEL_GIT_COMMIT_REF
    10  
    11  echo "CURRENT_GIT_BRANCH is $CURRENT_GIT_BRANCH"
    12  
    13  from_cache=false
    14  
    15  if [ -d "$PREVIEW_DIR" ]; then
    16      echo "$PREVIEW_DIR found"
    17      CLONE_DIR="$PREVIEW_DIR-tmp"
    18      from_cache=true
    19  fi
    20  
    21  # Clone the terraform-website project, if needed
    22  echo "⏳ Cloning the terraform-website repo, this might take a while..."
    23  git clone --depth=1 https://github.com/hashicorp/$REPO_TO_CLONE.git "$CLONE_DIR"
    24  
    25  if [ "$from_cache" = true ]; then
    26      echo "Setting up $PREVIEW_DIR"
    27      cp -R "./$CLONE_DIR/." "./$PREVIEW_DIR"
    28  fi
    29  
    30  # cd into the preview directory project
    31  cd "$PREVIEW_DIR"
    32  
    33  # Run the terraform-website content-repo start script
    34  PREVIEW_FROM_REPO=terraform \
    35  NAV_DATA_DIRNAME=../data \
    36  CONTENT_DIRNAME=../docs \
    37  IS_CONTENT_PREVIEW=true \
    38  CURRENT_GIT_BRANCH=$CURRENT_GIT_BRANCH \
    39  npm run build:deploy-preview