Skip to content

Commit

Permalink
ci: test docs-publish (OHIF#803)
Browse files Browse the repository at this point in the history
* ci: test docs-publish

* Require unit tests for dry run

* ci: Make sure our docs publish is executable

* Try to correct path issue

* Try repo prefix

* Try as yarn command

* Need a workspace to attach to from previous step

* Add before we call our bash script

* See if we can enforce commands being available -- or just install locally?

* Try again

* Try SSH

* Include username in gh https url

* Note regarding failure on PR branches

* Remove docs publish from PR workflow
  • Loading branch information
dannyrb authored Aug 27, 2019
1 parent 467712f commit 552df4c
Show file tree
Hide file tree
Showing 7 changed files with 175 additions and 39 deletions.
83 changes: 83 additions & 0 deletions .circleci/build-and-publish-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/bin/bash

# Set directory to location of this script
# https://stackoverflow.com/a/3355423/1867984
cd "$(dirname "$0")"

yarn -v
node -v

echo 'Installing Gitbook CLI'
yarn global bin
yarn config get prefix
yarn config set prefix ~/.yarn
export PATH="$PATH:`yarn global bin`"
# yarn global add gitbook-cli
# yarn global add gh-pages
# npm i gitbook-cli -g
# npm i gh-pages -g
# yarn list

# export PATH="$(yarn global bin):$PATH"

which gitbook
which gh-pages

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 [ -d "${D}" ]; then
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

# Back to repo root
cd ..

echo "Done generating documentation output"
echo 'PUBLISHING'

# git config --global user.email "[email protected]"
# git config --global user.name "ohif-bot"
# git config user.email "[email protected]"
# git config user.name "ohif-bot"

# WILL ALWAYS FAIL IF INITIATED FROM PR BRANCH
./node_modules/.bin/gh-pages \
--silent \
--repo https://$GITHUB_TOKEN@github.com/OHIF/Viewers.git \
--message 'Autogenerated Message: [ci skip]' \
--dist docs/latest/_book
18 changes: 9 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,13 @@ jobs:
no\n" > ~/.ssh/config
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "ohif-bot"
- run: yarn global add gitbook-cli
- run: yarn global add gh-pages
- run:
name: Generate Docs
command: yarn run staticDeploy
- run:
name: Publish Docs
command: yarn run docs:publish
- run: chmod +x ~/repo/.circleci/build-and-publish-docs.sh
- run: ~/repo/.circleci/build-and-publish-docs.sh
# - run:
# name: Generate & Publish Docs
# command: yarn run docs:publish

docker_publish:
<<: *defaults
Expand Down Expand Up @@ -330,9 +330,9 @@ workflows:
requires:
- cypress/run
# Update docs.ohif.org
# - docs_publish:
# requires:
# - cypress/run
- docs_publish:
requires:
- cypress/run
# Update hub.docker.org
# - docker_publish:
# requires:
Expand Down
3 changes: 0 additions & 3 deletions .netlify/build-deploy-preview.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ node -v
# should also symlink all projects appropriately
yarn install --no-ignore-optional --pure-lockfile

dir
ls

# Build && Move PWA Output
yarn run build:ci
mkdir -p ./.netlify/www/pwa
Expand Down
13 changes: 0 additions & 13 deletions .netlify/publishStaticSite.sh

This file was deleted.

64 changes: 64 additions & 0 deletions build-and-publish-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash

# Set directory to location of this script
# https://stackoverflow.com/a/3355423/1867984
cd "$(dirname "$0")"

yarn -v
node -v

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 [ -d "${D}" ]; then
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

# Back to repo root
cd ..

echo "Done generating documentation output"
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"test:unit:ci": "lerna run test:unit:ci --parallel --stream",
"test:e2e:ci": "cd platform/viewer && yarn run test:e2e:ci",
"see-changed": "lerna changed",
"docs:publish": "chmod +x ./build-and-publish-docs.sh && ./build-and-publish-docs.sh",
"release": "yarn run lerna:version && yarn run lerna:publish",
"lerna:version": "npx lerna version prerelease --force-publish",
"lerna:publish": "lerna publish from-package --canary --dist-tag canary"
Expand Down
32 changes: 18 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3823,11 +3823,6 @@ balanced-match@^1.0.0:
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=

[email protected]:
version "1.2.1"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.2.1.tgz#a91947da1f4a516ea38e5b4ec0ec3773675e0886"
integrity sha512-dwVUVIXsBZXwTuwnXI9RK8sBmgq09NDHzyR9SAph9eqk76gKK2JSQmZARC2zRC81JC2QTtxD0ARU5qTS25gIGw==

base64-js@^1.0.2:
version "1.3.1"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1"
Expand Down Expand Up @@ -5899,6 +5894,16 @@ dcmjs@^0.4.7:
loglevelnext "^3.0.0"
ndarray "^1.0.18"

dcmjs@^0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/dcmjs/-/dcmjs-0.5.1.tgz#9c069081213b9946196b8faf83b79602db2e7582"
integrity sha512-r6/S4tHqhPqsuwbuFmxpah31IeJPKtEOEm2Uf+FW3P68a9V4liVZzKmF7QzoI8sZWgBxmmwdtVr47JC1jHldJw==
dependencies:
"@babel/polyfill" "^7.2.5"
"@babel/runtime" "^7.3.1"
loglevelnext "^3.0.0"
ndarray "^1.0.18"

debug@*, [email protected], debug@^4.0.1, debug@^4.1.0, debug@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791"
Expand Down Expand Up @@ -14906,10 +14911,10 @@ react-transition-group@^4.1.1:
loose-envify "^1.4.0"
prop-types "^15.6.2"

[email protected].9:
version "0.0.9"
resolved "https://registry.yarnpkg.com/react-vtkjs-viewport/-/react-vtkjs-viewport-0.0.9.tgz#da79aa66f52dcd731bcc5abd2587cbb120a25331"
integrity sha512-VwRCY2DPxWMhix4v3PAtdENp3U1p+Z9nKf1Ch5+KWRKF6fWeA+B2glYKMYNpPnP4bULzVz9iwV+Zeojt3gEibA==
[email protected].11:
version "0.0.11"
resolved "https://registry.yarnpkg.com/react-vtkjs-viewport/-/react-vtkjs-viewport-0.0.11.tgz#cedd993ca226502bf0417a3748a5b2f806522519"
integrity sha512-ttWw7bU/lL/nJuaaKdtAc8448vMJmlRQzpkpuP/J+3lTzIQbQPCPU40LqgONjr7LvL5++61N2GJ8m+PRgHyfxQ==
dependencies:
moment "^2.24.0"

Expand Down Expand Up @@ -18291,12 +18296,11 @@ void-elements@^2.0.1:
resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-2.0.1.tgz#c066afb582bb1cb4128d60ea92392e94d5e9dbec"
integrity sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=

vtk.js@^8.11.0:
version "8.14.0"
resolved "https://registry.yarnpkg.com/vtk.js/-/vtk.js-8.14.0.tgz#c3be94c846a732a6f3e812a8a45a5dd3105939f2"
integrity sha512-/marh1LOJSxPYOc2j+GxiWUJt5EyFh9L2H+92vcgSn+AQ/FuaU7ovA2Q9BD0Sr2PJuIA7LlgxA6xOQzKHTJ1Yw==
vtk.js@^9.5.0:
version "9.7.0"
resolved "https://registry.yarnpkg.com/vtk.js/-/vtk.js-9.7.0.tgz#763767607a958fba5c70754434612f3066bd96a0"
integrity sha512-4IJJr2slOY+W/GjUdjElg3ViJSt6IF+siIJ4FmqOYQeOdTKRVxVYb7dAYVOH3MyVz8Zs39DEwJHHhRK5hkjsjg==
dependencies:
base64-js "1.2.1"
blueimp-md5 "2.10.0"
commander "2.11.0"
gl-matrix "3.0.0"
Expand Down

0 comments on commit 552df4c

Please sign in to comment.