ci: test docs-publish (#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
This commit is contained in:
1 parent
467712f8cd
commit
552df4c9a8
7 files changed
+175
-39
No files matched your search
@@ -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 "danny.ri.brown+ohif-bot@gmail.com"
|
||||
# git config --global user.name "ohif-bot"
|
||||
# git config user.email "danny.ri.brown+ohif-bot@gmail.com"
|
||||
# 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
|
||||
@@ -187,13 +187,13 @@ jobs:
|
||||
no\n" > ~/.ssh/config
|
||||
- run: git config --global user.email "danny.ri.brown+ohif-bot@gmail.com"
|
||||
- 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
|
||||
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user