Skip to content
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
LOOP = "false"
HOST = "/"
[context.branch-deploy]
command = "./scripts/branchdeploy.sh $DEPLOY_PRIME_URL"
command = "./scripts/branchdeploy.sh $DEPLOY_PRIME_URL $HEAD"
[context.branch-deploy.environment]
HUGO_VERSION = "0.79.0"
LOOP = "false"
Expand Down
14 changes: 8 additions & 6 deletions scripts/branchdeploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ RESET='\033[0m'

# script used to build a release branch
# expect the branch to be named release/<version>
# argument is the netlify base url
# argument $1 is the netlify base url
# argument $2 is the $HEAD netlify variable which is the branch name

releaseVersion=$(git rev-parse --abbrev-ref HEAD | sed 's/.*\///')
releaseVersion=$(echo $2 | sed 's/.*\///')

echo "branchdeploy => '$releaseVersion'"

echo "branchdeploy => '$releaseVersion'"

VERSION_STRING="$releaseVersion"
# In Unix environments, env variables should also be exported to be seen by Hugo
export VERSIONS=${VERSION_STRING}

run() {
export DGRAPH_ENDPOINT=${DGRAPH_ENDPOINT:-"https://play.dgraph.io/query?latency=true"}
Expand All @@ -40,9 +41,10 @@ run() {
fi
popd > /dev/null

echo -e "$(date) $GREEN Generating documentation static pages in the public folder. $RESET"
echo -e "$(date) $GREEN Generating documentation static pages in the folder public/docs/$releaseVersion. $RESET"

CURRENT_VERSION=${releaseVersion} \
VERSIONS=${VERSION_STRING} \
hugo --destination="public/docs/$releaseVersion" --baseURL="$1/docs/$releaseVersion" 1> /dev/null
cp "public/docs/$releaseVersion/sitemap.xml" public > /dev/null
echo -e "$(date) $GREEN Done building. $RESET"
Expand Down
3 changes: 2 additions & 1 deletion scripts/local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ set -e
GREEN='\033[32;1m'
RESET='\033[0m'

branch=$(git rev-parse --abbrev-ref HEAD)
echo "branch => '$branch'"
VERSIONS_ARRAY=(
'preview'
)
Expand Down Expand Up @@ -54,4 +56,3 @@ run() {
}

run "$1" "$2"