github.com/gofiber/fiber/v2@v2.47.0/.github/scripts/sync_docs.sh (about) 1 #!/usr/bin/env bash 2 3 # Some env variables 4 BRANCH="master" 5 MAJOR_VERSION="v2" 6 REPO_URL="github.com/gofiber/docs.git" 7 AUTHOR_EMAIL="github-actions[bot]@users.noreply.github.com" 8 AUTHOR_USERNAME="github-actions[bot]" 9 10 # Set commit author 11 git config --global user.email "${AUTHOR_EMAIL}" 12 git config --global user.name "${AUTHOR_USERNAME}" 13 14 if [[ $EVENT == "push" ]]; then 15 latest_commit=$(git rev-parse --short HEAD) 16 log_output=$(git log --oneline ${BRANCH} HEAD~1..HEAD --name-status -- docs/) 17 18 if [[ $log_output != "" ]]; then 19 git clone https://${TOKEN}@${REPO_URL} fiber-docs 20 cp -a docs/* fiber-docs/docs 21 22 # Push changes for next docs 23 cd fiber-docs/ || return 24 git add . 25 git commit -m "Add docs from https://github.com/gofiber/fiber/commit/${latest_commit}" 26 git push https://${TOKEN}@${REPO_URL} 27 fi 28 elif [[ $EVENT == "release" ]]; then 29 latest_tag=$(git describe --tags --abbrev=0) 30 31 # Push changes for stable docs 32 git clone https://${TOKEN}@${REPO_URL} fiber-docs 33 cd fiber-docs/ || return 34 cp -a docs/* versioned_docs/version-${MAJOR_VERSION}.x 35 git add . 36 git commit -m "Sync docs for ${latest_tag} release" 37 git push https://${TOKEN}@${REPO_URL} 38 fi