First attempt at a netlify deploy preview

This commit is contained in:
dannyrb committed 2019-07-16 09:24:24 -04:00
1 parent 91ee615aee
commit 2279e555a3
10 files changed
+212 -127

No files matched your search

+80
View File
@@ -0,0 +1,80 @@
#!/bin/bash
# Set directory to location of this script
# https://stackoverflow.com/a/3355423/1867984
cd "$(dirname "$0")"
# Helpful to verify which versions we're using
yarn -v
node -v
# Install GitBook CLI
echo 'Installing Gitbook CLI'
yarn global add gitbook-cli
echo 'Running Gitbook installation'
# Generate all version's GitBook output
# For each directory in /docs ...
cd ./../docs/
for D in *; do
if [ -d "${D}" ]; then
echo "Generating output for: ${D}"
cd "${D}"
# Clear previous output, generate new
rm -rf _book
gitbook install
gitbook build
cd ..
fi
done
# Move CNAME File into `latest`
cp CNAME ./latest/_book/CNAME
# Create a history folder in our latest version's output
mkdir ./latest/_book/history
# Move each version's files to latest's history folder
for D in *; do
# If it's a directory
if [ -d "${D}" ]; then
# If the directory name starts with `v` (v1, v2, etc.)
if [ "${D}" == v* ] ; then
echo "Moving ${D} to the latest version's history folder"
mkdir "./latest/_book/history/${D}"
cp -v -r "./${D}/_book"/* "./latest/_book/history/${D}"
fi
fi
done
cd ..
# Build and copy the PWA Viewer into the demo directory
mkdir ./docs/latest/_book/demo/
# Install build deps and all monorepo package dependencies. Yarn Workspaces
# should also symlink all projects appropriately
yarn install
# Navigate to our Viewer project
cd ./platform/viewer/
# Create a Versions File
node -p -e \"'export default \\'' + require('./package.json').version + '\\';'\" > src/version.js
# Copy over wado-image-loader codecs and worker file
npx cpx \"node_modules/cornerstone-wado-image-loader/dist/*.min.js*\" \"public\" -v
# Build using react-scripts
# npx cross-env PUBLIC_URL=/demo REACT_APP_CONFIG=config/netlify.js react-scripts --max_old_space_size=4096 build
# Build using WebPack
# TODO: consume public/config correctly instead of hardcode
npx cross-env NODE_ENV=production webpack-dev-server --config config/webpack.prod.js --mode production -w -d
# Copy output to the folder that is our publish target
npx cpx 'dist/**/*' ./../../docs/latest/_book/demo --verbose
echo 'Nothing left to see here. Go home, folks.'
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
# Set directory to location of this script
# https://stackoverflow.com/a/3355423/1867984
cd "$(dirname "$0")"
echo 'PUBLISHING'
./node_modules/.bin/gh-pages \
--silent \
--repo https://$GITHUB_TOKEN@github.com/OHIF/Viewers.git \
--message 'Autogenerated Message: [ci skip]' \
--dist docs/latest/_book