Skip to content

Commit

Permalink
Add support for building docs for only one project
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Mar 25, 2021
1 parent baedbdc commit 93d1d50
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
6 changes: 6 additions & 0 deletions scripts/build-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

set -eux

PROJECT=${1:-}
CWD=$(pwd)
TEMP_DIR=$(mktemp -d)

Expand All @@ -16,6 +17,11 @@ build_docs() {
shift 2
MODULES=$*

if [[ -n "$PROJECT" ]]; then
if [[ "$DOCS_FOLDER" != "$PROJECT" ]]; then
return
fi
fi
SOURCEKITTEN_FOLDER="$TEMP_DIR/sourcekitten/$DOCS_FOLDER"

mkdir -p $SOURCEKITTEN_FOLDER
Expand Down
23 changes: 17 additions & 6 deletions scripts/commit-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -eux

FOLDER=current
SUBFOLDER=${1:-}

# stash everything that isn't in docs, store result in STASH_RESULT
STASH_RESULT=$(git stash push -- ":(exclude)docs")
Expand All @@ -11,12 +12,22 @@ CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
REVISION_HASH=$(git rev-parse HEAD)

git checkout gh-pages
# copy contents of docs to docs/current replacing the ones that are already there
rm -rf "$FOLDER"
mv docs/ "$FOLDER"/
# commit
git add --all "$FOLDER"
git commit -m "Documentation for https://github.com/soto-project/soto-core/tree/$REVISION_HASH"
if [[ -z "$SUBFOLDER" ]]; then
# copy contents of docs to docs/current replacing the ones that are already there
rm -rf "$FOLDER"
mv docs/ "$FOLDER"/
# commit
git add --all "$FOLDER"
else
# copy contents of subfolder of docs to docs/current replacing the ones that are already there
rm -rf "$FOLDER"/"$SUBFOLDER"
mv docs/"$SUBFOLDER"/ "$FOLDER"/"$SUBFOLDER"
# commit
git add --all "$FOLDER"/"$SUBFOLDER"
fi

git status
git commit -m "Documentation for https://github.com/hummingbird-project/hummingbird/tree/$REVISION_HASH"
git push
# return to branch
git checkout $CURRENT_BRANCH
Expand Down

0 comments on commit 93d1d50

Please sign in to comment.