mirror of
https://github.com/gofiber/storage.git
synced 2025-10-05 16:48:25 +08:00
📝 docs: automated synchronization with gofiber/docs
(#880)
* add sync_docs script * update docs * update docs * Update README.md - sort lines and fix closing image tag * update docs --------- Co-authored-by: RW <rene@gofiber.io>
This commit is contained in:
35
.github/scripts/sync_docs.sh
vendored
Executable file
35
.github/scripts/sync_docs.sh
vendored
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Some env variables
|
||||
BRANCH="main"
|
||||
REPO="storage"
|
||||
REPO_URL="github.com/gofiber/docs.git"
|
||||
AUTHOR_EMAIL="github-actions[bot]@users.noreply.github.com"
|
||||
AUTHOR_USERNAME="github-actions[bot]"
|
||||
|
||||
# Set commit author
|
||||
git config --global user.email "${AUTHOR_EMAIL}"
|
||||
git config --global user.name "${AUTHOR_USERNAME}"
|
||||
|
||||
# Exit if event is not PUSH
|
||||
if [ "$EVENT" != "push" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
latest_commit=$(git rev-parse --short HEAD)
|
||||
|
||||
git clone https://${TOKEN}@${REPO_URL} fiber-docs
|
||||
for f in $(find . -type f -name "*.md" -not -path "./fiber-docs/*"); do
|
||||
log_output=$(git log --oneline "${BRANCH}" HEAD~1..HEAD --name-status -- "${f}")
|
||||
|
||||
if [[ $log_output != "" || ! -f "fiber-docs/docs/$REPO/$f" ]]; then
|
||||
mkdir -p fiber-docs/docs/$REPO/$(dirname $f)
|
||||
cp "${f}" fiber-docs/docs/$REPO/$f
|
||||
fi
|
||||
done
|
||||
|
||||
# Push changes for storage instance docs
|
||||
cd fiber-docs/ || return
|
||||
git add .
|
||||
git commit -m "Add docs from https://github.com/gofiber/$REPO/commit/${latest_commit}"
|
||||
git push https://${TOKEN}@${REPO_URL}
|
Reference in New Issue
Block a user