Skip to content

Commit 37df2fc

Browse files
committed
build site with development spec on development
This change adds a check for the Jenkins `GIT_LOCAL_BRANCH` environment variable, and then pulls the spec accordingly. `master` pulls `master` from https://raw.githubusercontent.com/linode/linode-api-docs/master/openapi.yaml `development` pulls `development`from https://raw.githubusercontent.com/linode/linode-api-docs/development/openapi.yaml Any others, default to `master`.
1 parent 0a3bf92 commit 37df2fc

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

getDependencies.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1+
#!/usr/bin/env bash
2+
13
BLUE='\033[0;34m'
24
NC='\033[0m' # No Color
35

6+
SPEC_BRANCH="master"
7+
if [[ "$GIT_LOCAL_BRANCH" =~ ^(master|development)$ ]]; then
8+
SPEC_BRANCH="${GIT_LOCAL_BRANCH}"
9+
fi
10+
411
SPEC_FILE=""
512
if [ -n ${1} ]; then
613
SPEC_FILE=../${1}
@@ -24,7 +31,7 @@ else
2431
echo
2532
printf "${BLUE}Fetching API specs${NC}\n"
2633
cd -
27-
curl https://raw.githubusercontent.com/linode/linode-api-docs/master/openapi.yaml > static/api/docs/v4/openapi.yaml;
34+
curl "https://raw.githubusercontent.com/linode/linode-api-docs/${SPEC_BRANCH}/openapi.yaml" > static/api/docs/v4/openapi.yaml;
2835
fi
2936

3037
echo
@@ -37,4 +44,4 @@ printf "${BLUE}Converting YAML to JSON${NC}\n"
3744
node_modules/yamljs/bin/yaml2json static/api/docs/v4/openapi.yaml > static/api/docs/v4/spec.json
3845
# some data manipulation to fix the result of the conversion above
3946
sed -i.bak 's@\\\\[[:space:]]@\\\\\\n @g' static/api/docs/v4/spec.json
40-
rm static/api/docs/v4/spec.json.bak
47+
rm static/api/docs/v4/spec.json.bak

0 commit comments

Comments
 (0)