Skip to content

Commit

Permalink
chore(docs-gen): grab the correct path to new docs
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelovicentegc committed Dec 14, 2023
1 parent 54ea8ec commit af6ece7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 7 additions & 6 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,26 @@ cat jsdoc.json
echo "Generating documentation"
jsdoc -r $JSDOC_INPUT_FILES -c jsdoc.json -d "$DOCS_DIRECTORY"

echo "Loading index_manager and grabbing path to first html file"
source index_manager.sh
FIRST_HTML_FILE=$(find_first_html_file "$DOCS_DIRECTORY")

echo "Copying documentation to destination git repository"
ls -la "$DOCS_DIRECTORY"
cp -ra "$DOCS_DIRECTORY"/. "$CLONE_DIR"

echo "Copying templates and index_manager to destination git repository"
echo "Copying templates to destination git repository"
cp -ra templates/. "$CLONE_DIR"
cp -ra index_manager.sh "$CLONE_DIR"

echo "Changing directory to destination git repository"
cd "$CLONE_DIR"

echo "Generating or updating index.html"
source index_manager.sh
create_index_html "."
update_index_html "index.html" "<li><a href=\"./$DOCS_DIRECTORY/index.html\">$GITHUB_REF</a></li>"
update_index_html "index.html" "<li><a href=\"./$FIRST_HTML_FILE\">$FIRST_HTML_FILE</a></li>"

echo "Deleting templates and index_manager from destination git repository"
echo "Deleting templates from destination git repository"
rm -rf templates
rm index_manager.sh

echo "Files that will be pushed:"
ls -la
Expand Down
6 changes: 6 additions & 0 deletions index_manager.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/sh -l

# This script gets the folder and version output of the package's generated docs from jsdoc output
find_first_html_file () {
find "$1" -name '*.html' | head -n 1
}

# This script will add a new line of HTML to the index.html file
# The new line of HTML will be added after the line that contains the comment <!-- @jsdoc-builder-action new-version -->
update_index_html () {
Expand All @@ -23,5 +28,6 @@ create_index_html () {
fi
}

export find_first_html_file
export create_index_html
export update_html_version

0 comments on commit af6ece7

Please sign in to comment.