From b40f2dfdd7ae0a35daa34716fb53b6399b3908f7 Mon Sep 17 00:00:00 2001 From: Arjan Dikhoff Date: Fri, 25 Oct 2024 21:40:32 +0200 Subject: [PATCH] Cleanup --- build.sh | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/build.sh b/build.sh index 4851d0ded1e8..ac1c8e41cba3 100755 --- a/build.sh +++ b/build.sh @@ -2,19 +2,19 @@ # Init env vars -DATE=`date` -WORK_DIR=`pwd` -REPORT_DIR="$WORK_DIR/build-report" -REPORT_FILE="$REPORT_DIR/index.html" +date=`date` +workDir=`pwd` +reportDir="$workDir/build-report" +reportFile="$reportDir/index.html" -GIT_BRANCH=`git rev-parse --abbrev-ref HEAD` +gitBranch=`git rev-parse --abbrev-ref HEAD` if [ -n "$CF_PAGES" ] then echo "We are on Cloudflare Pages. Retrieve branch from env." - GIT_BRANCH=$CF_PAGES_BRANCH + gitBranch=$CF_PAGES_BRANCH fi -GIT_COMMIT_MESSAGE="branch $GIT_BRANCH on $DATE" -GIT_LIVE_BRANCH=${2:-develop} +gitCommitMessage="branch $gitBranch on $date" +redotDocsLiveBranch=${2:-develop} INPUT_DIR="." MIGRATE_DIR="_migrated" @@ -23,17 +23,17 @@ REPO_DIR="_repo" LIVE_ROOT="redot-docs-live" LIVE_REPO="git@github.com:Redot-Engine/$LIVE_ROOT.git" -BUILD_DIR="html/en/$GIT_BRANCH" +BUILD_DIR="html/en/$gitBranch" # Report vars and intention -mkdir -p $REPORT_DIR -rm $REPORT_FILE -echo "reporting to $REPORT_FILE" -echo "Building $GIT_COMMIT_MESSAGE" -echo "Live branch: $GIT_LIVE_BRANCH" +mkdir -p $reportDir +rm $reportFile +echo "reporting to $reportFile" +echo "Building $gitCommitMessage" +echo "Live branch: $redotDocsLiveBranch" echo "Temp dirs: $MIGRATE_DIR, $SPHINX_DIR, $REPO_DIR" -echo "Live root: $LIVE_ROOT, live repo: $LIVE_REPO, build dir: $BUILD_DIR, report dir: $REPORT_DIR" +echo "Live root: $LIVE_ROOT, live repo: $LIVE_REPO, build dir: $BUILD_DIR, report dir: $reportDir" echo "Delete temps" rm -rf $MIGRATE_DIR @@ -50,28 +50,28 @@ echo "Translate to html" mkdir -p $SPHINX_DIR # sphinx-build -b html -j 4 $MIGRATE_DIR $SPHINX_DIR -echo "DUMMY FILE FOR TESTING: $DATE" > $SPHINX_DIR/test.html +echo "DUMMY FILE FOR TESTING: $date" > $SPHINX_DIR/test.html echo "Cloning $LIVE_REPO $REPO_DIR" git clone $LIVE_REPO $REPO_DIR cd $REPO_DIR -echo "Checking out $GIT_LIVE_BRANCH" -git checkout $GIT_LIVE_BRANCH +echo "Checking out $redotDocsLiveBranch" +git checkout $redotDocsLiveBranch -SSH_COMMAND="ssh" # Add -v, -vv, or -vvv for verbose debugging -git config --global core.sshCommand "$SSH_COMMAND" +SSH_COMMAND="ssh -v" # Add -v, -vv, or -vvv for verbose debugging +git config core.sshCommand "$SSH_COMMAND" echo "Using ssh command: $SSH_COMMAND" if [ -n "$CF_PAGES" ] then - echo "Remove Cloudflare redirect." + echo "We are on Cloudflare Pages. Setting custom ssh key and method" # HACK: Remove annoying https redirect. I presume this was used by Cloudflare + echo "Remove Cloudflare redirect." insteadof=`git config --list | grep insteadof` remove=`echo $insteadof | cut -d "=" -f 1` git config --global --unset $remove - echo "We are on Cloudflare Pages. Setting custom ssh key and method" mkdir ~/.ssh echo "$BUILD_SSH_KEY" > ~/.ssh/id_ed25519 echo "$BUILD_SSH_KEY_PUB" > ~/.ssh/id_ed25519.pub @@ -99,9 +99,9 @@ mkdir -p $BUILD_DIR echo "cp -r ../$SPHINX_DIR/* $BUILD_DIR" cp -r ../$SPHINX_DIR/* $BUILD_DIR -echo "Commit and push to $GIT_LIVE_BRANCH, with message $GIT_COMMIT_MESSAGE" +echo "Commit and push to $redotDocsLiveBranch, with message $gitCommitMessage" git add . -git commit --message "$GIT_COMMIT_MESSAGE" +git commit --message "$gitCommitMessage" git push -vvv --force echo "Done. Made by @Craptain"