Skip to content

Commit 552df4c

Browse files
authored
ci: test docs-publish (OHIF#803)
* 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
1 parent 467712f commit 552df4c

7 files changed

+175
-39
lines changed

Diff for: .circleci/build-and-publish-docs.sh

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/bin/bash
2+
3+
# Set directory to location of this script
4+
# https://stackoverflow.com/a/3355423/1867984
5+
cd "$(dirname "$0")"
6+
7+
yarn -v
8+
node -v
9+
10+
echo 'Installing Gitbook CLI'
11+
yarn global bin
12+
yarn config get prefix
13+
yarn config set prefix ~/.yarn
14+
export PATH="$PATH:`yarn global bin`"
15+
# yarn global add gitbook-cli
16+
# yarn global add gh-pages
17+
# npm i gitbook-cli -g
18+
# npm i gh-pages -g
19+
# yarn list
20+
21+
# export PATH="$(yarn global bin):$PATH"
22+
23+
which gitbook
24+
which gh-pages
25+
26+
echo 'Running Gitbook installation'
27+
28+
# Generate all version's GitBook output
29+
# For each directory in /docs ...
30+
cd ./../docs/
31+
for D in *; do
32+
if [ -d "${D}" ]; then
33+
34+
echo "Generating output for: ${D}"
35+
cd "${D}"
36+
37+
# Clear previous output, generate new
38+
rm -rf _book
39+
gitbook install
40+
gitbook build
41+
42+
cd ..
43+
44+
fi
45+
done
46+
47+
# Move CNAME File into `latest`
48+
cp CNAME ./latest/_book/CNAME
49+
50+
# Create a history folder in our latest version's output
51+
mkdir ./latest/_book/history
52+
53+
# Move each version's files to latest's history folder
54+
for D in *; do
55+
if [ -d "${D}" ]; then
56+
if [ "${D}" == v* ] ; then
57+
58+
echo "Moving ${D} to the latest version's history folder"
59+
60+
mkdir "./latest/_book/history/${D}"
61+
cp -v -r "./${D}/_book"/* "./latest/_book/history/${D}"
62+
63+
fi
64+
fi
65+
done
66+
67+
# Back to repo root
68+
cd ..
69+
70+
echo "Done generating documentation output"
71+
echo 'PUBLISHING'
72+
73+
# git config --global user.email "[email protected]"
74+
# git config --global user.name "ohif-bot"
75+
# git config user.email "[email protected]"
76+
# git config user.name "ohif-bot"
77+
78+
# WILL ALWAYS FAIL IF INITIATED FROM PR BRANCH
79+
./node_modules/.bin/gh-pages \
80+
--silent \
81+
--repo https://$GITHUB_TOKEN@github.com/OHIF/Viewers.git \
82+
--message 'Autogenerated Message: [ci skip]' \
83+
--dist docs/latest/_book

Diff for: .circleci/config.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,13 @@ jobs:
187187
no\n" > ~/.ssh/config
188188
- run: git config --global user.email "[email protected]"
189189
- run: git config --global user.name "ohif-bot"
190+
- run: yarn global add gitbook-cli
190191
- run: yarn global add gh-pages
191-
- run:
192-
name: Generate Docs
193-
command: yarn run staticDeploy
194-
- run:
195-
name: Publish Docs
196-
command: yarn run docs:publish
192+
- run: chmod +x ~/repo/.circleci/build-and-publish-docs.sh
193+
- run: ~/repo/.circleci/build-and-publish-docs.sh
194+
# - run:
195+
# name: Generate & Publish Docs
196+
# command: yarn run docs:publish
197197

198198
docker_publish:
199199
<<: *defaults
@@ -330,9 +330,9 @@ workflows:
330330
requires:
331331
- cypress/run
332332
# Update docs.ohif.org
333-
# - docs_publish:
334-
# requires:
335-
# - cypress/run
333+
- docs_publish:
334+
requires:
335+
- cypress/run
336336
# Update hub.docker.org
337337
# - docker_publish:
338338
# requires:

Diff for: .netlify/build-deploy-preview.sh

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ node -v
1313
# should also symlink all projects appropriately
1414
yarn install --no-ignore-optional --pure-lockfile
1515

16-
dir
17-
ls
18-
1916
# Build && Move PWA Output
2017
yarn run build:ci
2118
mkdir -p ./.netlify/www/pwa

Diff for: .netlify/publishStaticSite.sh

-13
This file was deleted.

Diff for: build-and-publish-docs.sh

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/bash
2+
3+
# Set directory to location of this script
4+
# https://stackoverflow.com/a/3355423/1867984
5+
cd "$(dirname "$0")"
6+
7+
yarn -v
8+
node -v
9+
10+
echo 'Installing Gitbook CLI'
11+
yarn global add gitbook-cli
12+
13+
echo 'Running Gitbook installation'
14+
15+
# Generate all version's GitBook output
16+
# For each directory in /docs ...
17+
cd ./../docs/
18+
for D in *; do
19+
if [ -d "${D}" ]; then
20+
21+
echo "Generating output for: ${D}"
22+
cd "${D}"
23+
24+
# Clear previous output, generate new
25+
rm -rf _book
26+
gitbook install
27+
gitbook build
28+
29+
cd ..
30+
31+
fi
32+
done
33+
34+
# Move CNAME File into `latest`
35+
cp CNAME ./latest/_book/CNAME
36+
37+
# Create a history folder in our latest version's output
38+
mkdir ./latest/_book/history
39+
40+
# Move each version's files to latest's history folder
41+
for D in *; do
42+
if [ -d "${D}" ]; then
43+
if [ "${D}" == v* ] ; then
44+
45+
echo "Moving ${D} to the latest version's history folder"
46+
47+
mkdir "./latest/_book/history/${D}"
48+
cp -v -r "./${D}/_book"/* "./latest/_book/history/${D}"
49+
50+
fi
51+
fi
52+
done
53+
54+
# Back to repo root
55+
cd ..
56+
57+
echo "Done generating documentation output"
58+
echo 'PUBLISHING'
59+
60+
./node_modules/.bin/gh-pages \
61+
--silent \
62+
--repo https://$GITHUB_TOKEN@github.com/OHIF/Viewers.git \
63+
--message 'Autogenerated Message: [ci skip]' \
64+
--dist docs/latest/_book

Diff for: package.json

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"test:unit:ci": "lerna run test:unit:ci --parallel --stream",
2424
"test:e2e:ci": "cd platform/viewer && yarn run test:e2e:ci",
2525
"see-changed": "lerna changed",
26+
"docs:publish": "chmod +x ./build-and-publish-docs.sh && ./build-and-publish-docs.sh",
2627
"release": "yarn run lerna:version && yarn run lerna:publish",
2728
"lerna:version": "npx lerna version prerelease --force-publish",
2829
"lerna:publish": "lerna publish from-package --canary --dist-tag canary"

Diff for: yarn.lock

+18-14
Original file line numberDiff line numberDiff line change
@@ -3823,11 +3823,6 @@ balanced-match@^1.0.0:
38233823
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
38243824
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
38253825

3826-
3827-
version "1.2.1"
3828-
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.2.1.tgz#a91947da1f4a516ea38e5b4ec0ec3773675e0886"
3829-
integrity sha512-dwVUVIXsBZXwTuwnXI9RK8sBmgq09NDHzyR9SAph9eqk76gKK2JSQmZARC2zRC81JC2QTtxD0ARU5qTS25gIGw==
3830-
38313826
base64-js@^1.0.2:
38323827
version "1.3.1"
38333828
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1"
@@ -5899,6 +5894,16 @@ dcmjs@^0.4.7:
58995894
loglevelnext "^3.0.0"
59005895
ndarray "^1.0.18"
59015896

5897+
dcmjs@^0.5.1:
5898+
version "0.5.1"
5899+
resolved "https://registry.yarnpkg.com/dcmjs/-/dcmjs-0.5.1.tgz#9c069081213b9946196b8faf83b79602db2e7582"
5900+
integrity sha512-r6/S4tHqhPqsuwbuFmxpah31IeJPKtEOEm2Uf+FW3P68a9V4liVZzKmF7QzoI8sZWgBxmmwdtVr47JC1jHldJw==
5901+
dependencies:
5902+
"@babel/polyfill" "^7.2.5"
5903+
"@babel/runtime" "^7.3.1"
5904+
loglevelnext "^3.0.0"
5905+
ndarray "^1.0.18"
5906+
59025907
debug@*, [email protected], debug@^4.0.1, debug@^4.1.0, debug@^4.1.1:
59035908
version "4.1.1"
59045909
resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791"
@@ -14906,10 +14911,10 @@ react-transition-group@^4.1.1:
1490614911
loose-envify "^1.4.0"
1490714912
prop-types "^15.6.2"
1490814913

14909-
14910-
version "0.0.9"
14911-
resolved "https://registry.yarnpkg.com/react-vtkjs-viewport/-/react-vtkjs-viewport-0.0.9.tgz#da79aa66f52dcd731bcc5abd2587cbb120a25331"
14912-
integrity sha512-VwRCY2DPxWMhix4v3PAtdENp3U1p+Z9nKf1Ch5+KWRKF6fWeA+B2glYKMYNpPnP4bULzVz9iwV+Zeojt3gEibA==
14914+
14915+
version "0.0.11"
14916+
resolved "https://registry.yarnpkg.com/react-vtkjs-viewport/-/react-vtkjs-viewport-0.0.11.tgz#cedd993ca226502bf0417a3748a5b2f806522519"
14917+
integrity sha512-ttWw7bU/lL/nJuaaKdtAc8448vMJmlRQzpkpuP/J+3lTzIQbQPCPU40LqgONjr7LvL5++61N2GJ8m+PRgHyfxQ==
1491314918
dependencies:
1491414919
moment "^2.24.0"
1491514920

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

18294-
vtk.js@^8.11.0:
18295-
version "8.14.0"
18296-
resolved "https://registry.yarnpkg.com/vtk.js/-/vtk.js-8.14.0.tgz#c3be94c846a732a6f3e812a8a45a5dd3105939f2"
18297-
integrity sha512-/marh1LOJSxPYOc2j+GxiWUJt5EyFh9L2H+92vcgSn+AQ/FuaU7ovA2Q9BD0Sr2PJuIA7LlgxA6xOQzKHTJ1Yw==
18299+
vtk.js@^9.5.0:
18300+
version "9.7.0"
18301+
resolved "https://registry.yarnpkg.com/vtk.js/-/vtk.js-9.7.0.tgz#763767607a958fba5c70754434612f3066bd96a0"
18302+
integrity sha512-4IJJr2slOY+W/GjUdjElg3ViJSt6IF+siIJ4FmqOYQeOdTKRVxVYb7dAYVOH3MyVz8Zs39DEwJHHhRK5hkjsjg==
1829818303
dependencies:
18299-
base64-js "1.2.1"
1830018304
blueimp-md5 "2.10.0"
1830118305
commander "2.11.0"
1830218306
gl-matrix "3.0.0"

0 commit comments

Comments
 (0)