File tree Expand file tree Collapse file tree 3 files changed +38
-10
lines changed
Expand file tree Collapse file tree 3 files changed +38
-10
lines changed Original file line number Diff line number Diff line change 22resources /
33node_modules /
44package-lock.json
5- .hugo_build.lock
5+ .hugo_build.lock
6+ # Local Netlify folder
7+ .netlify
Original file line number Diff line number Diff line change 11.PHONY : serve
22serve :
33 echo " Local development"
4- cd themes/docsy && git submodule update -f --init
5- cp content/en/docs/images/* static/images/
6- sed -i -e ' s/\(images\/[a-zA-Z\-]*\.svg\)/\/\1/g' content/en/docs/* .md
4+ ./scripts/build-static.sh
75 hugo server \
86 --baseURL $(URL ) \
97 --buildDrafts \
@@ -14,14 +12,10 @@ serve:
1412
1513.PHONY : production-build
1614production-build :
17- cd themes/docsy && git submodule update -f --init
18- cp content/en/docs/images/* static/images/
19- sed -i -e ' s/\(images\/[a-zA-Z\-]*\.svg\)/\/\1/g' content/en/docs/* .md
15+ ./scripts/build-static.sh
2016 hugo --baseURL $(URL )
2117
2218.PHONY : preview-build
2319preview-build :
24- cd themes/docsy && git submodule update -f --init
25- cp content/en/docs/images/* static/images/
26- sed -i -e ' s/\(images\/[a-zA-Z\-]*\.svg\)/\/\1/g' content/en/docs/* .md
20+ ./scripts/build-static.sh
2721 hugo --baseURL $(DEPLOY_PRIME_URL )
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ #
3+ # Build static content from the spec repo
4+ set -exo pipefail
5+
6+ BASE_DIR=" $( cd " $( dirname " $0 " ) /.." > /dev/null 2>&1 && pwd ) "
7+ STATIC_DIR=" ${BASE_DIR} /static"
8+ DOCS_DIR=" ${BASE_DIR} /content/en/docs"
9+
10+ # Serve static images
11+ cp ${DOCS_DIR} /images/* ${STATIC_DIR} /images/
12+ sed -i -e ' s/\(images\/[a-zA-Z\-]*\.svg\)/\/\1/g' ${DOCS_DIR} /* .md
13+
14+ # Serve versioned schemas
15+ cd ${DOCS_DIR}
16+ ORIGINAL_REVISION=$( git rev-parse HEAD)
17+ for tag in $( git tag) ; do
18+ # Get the version by trimming the "v"
19+ version=$( printf $tag | sed ' s/^v//g' )
20+ TARGET_SCHEMA_FOLDER=" ${STATIC_DIR} /${version} /schema"
21+ # Create the folder if it doesn't exists yet
22+ mkdir -p ${TARGET_SCHEMA_FOLDER} || true
23+
24+ git checkout " ${tag} "
25+ for schema in $( ls schemas/* json) ; do
26+ # Extract the schema name from the schema id itself
27+ TARGET_SCHEMA=$( awk -F' /' ' /"\$id"/{ print $6 }' $schema | sed -e ' s/",//g' )
28+ # Copy the file to static with the new name
29+ cp ${schema} ${TARGET_SCHEMA_FOLDER} /${TARGET_SCHEMA}
30+ done
31+ done
32+ git checkout ${ORIGINAL_REVISION}
You can’t perform that action at this time.
0 commit comments