Skip to content

Commit

Permalink
docusaurus preparations
Browse files Browse the repository at this point in the history
  • Loading branch information
ReneWerner87 committed Nov 26, 2024
1 parent 5e3c1b1 commit c8189d8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
25 changes: 16 additions & 9 deletions .github/scripts/sync_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,25 @@ git clone https://${TOKEN}@${REPO_URL} fiber-docs
latest_commit=$(git rev-parse --short HEAD)

# remove all files in the docs directory
rm -rf $ROOT/../fiberDocs/docs/${REPO_DIR}/*

for f in $(find -E . -type f -iregex '.*\.(md|png|jpe?g|gif|bmp|svg|webp)$' -not -path "./(fiberDocs)/*" -not -path "*/vendor/*" -not -path "*/.github/*" -not -path "*/.*"); do
log_output=$(git log --oneline "${BRANCH}" HEAD~1..HEAD --name-status -- "${f}")

if [[ $log_output != "" || ! -f "fiber-docs/docs/${REPO_DIR}/$f" ]]; then
mkdir -p fiber-docs/docs/${REPO_DIR}/$(dirname $f)
cp "${f}" fiber-docs/docs/${REPO_DIR}/$f
rm -rf fiber-docs/docs/${REPO_DIR}/*

# Find and copy relevant files
find . \
-type f \
\( -iname '*.md' -o -iname '*.png' -o -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.gif' -o -iname '*.bmp' -o -iname '*.svg' -o -iname '*.webp' \) \
-not -path "./fiber-docs/*" \
-not -path "*/vendor/*" \
-not -path "*/.github/*" \
-not -path "*/.*" |
while IFS= read -r f; do
log_output=$(git log --oneline "${BRANCH}" HEAD~1..HEAD --name-status -- "${f}" || true)

if [[ -n $log_output || ! -f "fiber-docs/docs/${REPO_DIR}/${f}" ]]; then
mkdir -p fiber-docs/docs/${REPO_DIR}/$(dirname "$f")
cp "$f" fiber-docs/docs/${REPO_DIR}/$f
fi
done


# Push changes
cd fiber-docs/ || true
git add .
Expand Down
14 changes: 11 additions & 3 deletions .github/scripts/sync_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,16 @@ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
# remove all files in the docs directory
rm -rf $ROOT/../fiberDocs/docs/${REPO_DIR}/*

for f in $(find -E . -type f -iregex '.*\.(md|png|jpe?g|gif|bmp|svg|webp)$' -not -path "./(fiberDocs)/*" -not -path "*/vendor/*" -not -path "*/.github/*" -not -path "*/.*"); do
# Find and copy relevant files
find . \
-type f \
\( -iname '*.md' -o -iname '*.png' -o -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.gif' -o -iname '*.bmp' -o -iname '*.svg' -o -iname '*.webp' \) \
-not -path "./fiber-docs/*" \
-not -path "*/vendor/*" \
-not -path "*/.github/*" \
-not -path "*/.*" |
while IFS= read -r f; do
echo "Copying $f"
mkdir -p $ROOT/../fiberDocs/docs/${REPO_DIR}/$(dirname $f)
cp "${f}" $ROOT/../fiberDocs/docs/${REPO_DIR}/$f
mkdir -p $ROOT/../fiberDocs/docs/${REPO_DIR}/$(dirname "$f")
cp "$f" $ROOT/../fiberDocs/docs/${REPO_DIR}/$f
done

0 comments on commit c8189d8

Please sign in to comment.