diff --git a/tools/branch-deploy.sh b/tools/branch-deploy.sh index ba04946..df1cdfb 100755 --- a/tools/branch-deploy.sh +++ b/tools/branch-deploy.sh @@ -1,18 +1,23 @@ #!/bin/bash # Deploys all branches of a Hugo repository to a structure of folders. # Useful for deploying all PRs/branches of a Hugo installation to a test URL for viewing. +set -u # Args: folder -TARGET_FOLDER="$1" +TARGET_FOLDER=$(realpath $1) +URL_BASE="$2" +INDEX_PAGE="${TARGET_FOLDER}/index.html" mkdir -p "${TARGET_FOLDER}" # Track all remote branches locally -git branch -r | grep -v '\->' | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | while read remote; do git branch --track "${remote#origin/}" "$remote"; done +git branch -r | grep -v '\->' | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | while read remote; do git branch --track "${remote#origin/}" "$remote" 2>/dev/null; done # Pull the branches -git pull --all -git fetch --all +git pull --all > /dev/null +git fetch --all > /dev/null + +echo -e "