Skip to content

Commit 9058b02

Browse files
committed
separate netlify build tasks
1 parent f4901bc commit 9058b02

File tree

1 file changed

+33
-20
lines changed

1 file changed

+33
-20
lines changed

scripts/netlify-build.sh

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,41 @@
11
#!/bin/sh
22

3-
mkdir netlify-build
3+
# Make sure to set $BUILD_CONTEXT in the Netlify "Deploy Settings"
4+
echo "Building [$BUILD_CONTEXT] for netlify"
45

56
yarn
67
yarn add gauge --ignore-workspace-root-check # netlify quirk
78
yarn bootstrap --core
89

9-
echo "netlify-build docs"
10-
pushd docs
11-
yarn install
12-
popd
13-
yarn docs:build
14-
mv docs/public/* netlify-build/
15-
16-
echo "netlify-build React examples"
17-
pushd examples/cra-kitchen-sink
18-
yarn add tapable # netlify quirk
19-
yarn build-storybook
20-
mv storybook-static ../../netlify-build/cra-kitchen-sink
21-
popd
22-
23-
echo "netlify-build Vue examples"
24-
pushd examples/vue-kitchen-sink
25-
yarn build-storybook
26-
mv storybook-static ../../netlify-build/vue-kitchen-sink
27-
popd
10+
if [ "$BUILD_CONTEXT" = "DOCS" ]; then
2811

12+
echo "netlify-build docs"
13+
pushd docs
14+
yarn install
15+
popd
16+
yarn docs:build
17+
mv docs/public netlify-build
18+
19+
elif [ "$BUILD_CONTEXT" = "CRA" ]; then
20+
21+
echo "netlify-build React examples"
22+
pushd examples/cra-kitchen-sink
23+
yarn add tapable # netlify quirk
24+
yarn build-storybook
25+
mv storybook-static ../../netlify-build
26+
popd
27+
28+
elif [ "$BUILD_CONTEXT" = "VUE" ]; then
29+
30+
echo "netlify-build Vue examples"
31+
pushd examples/vue-kitchen-sink
32+
yarn build-storybook
33+
mv storybook-static ../../netlify-build
34+
popd
35+
36+
else
37+
RED='\033[0;31m'
38+
NOCOLOR='\033[0m'
39+
echo "Unrecognized BUILD_CONTEXT \"${RED}$BUILD_CONTEXT${NOCOLOR}\"" 1>&2
40+
41+
fi

0 commit comments

Comments
 (0)