Skip to content

Commit

Permalink
Add build report and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
adikhoff committed Oct 24, 2024
1 parent 7af0817 commit 9995218
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 22 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ _build-old/
_migrated/
_sphinx/
_repo/
build-report/
env/
__pycache__
*.pyc
Expand Down
50 changes: 28 additions & 22 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,51 +1,57 @@
#!/bin/bash

GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
DATE=`date`
REPORT_DIR="build-report"
REPORT_FILE="$REPORT_DIR/index.html"

GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
GIT_COMMIT_MESSAGE="branch $GIT_BRANCH on $DATE"
GIT_LIVE_BRANCH=${2:-develop}
echo "Building $GIT_COMMIT_MESSAGE"
echo "Live branch: $GIT_LIVE_BRANCH"

INPUT_DIR="."
MIGRATE_DIR="_migrated"
SPHINX_DIR="_sphinx"
REPO_DIR="_repo"
echo "Temp dirs: $MIGRATE_DIR, $SPHINX_DIR, $REPO_DIR"

LIVE_ROOT="redot-docs-live"
LIVE_REPO="[email protected]:Redot-Engine/$LIVE_ROOT.git"
BUILD_DIR="html/en/$GIT_BRANCH"

echo "Live root: $LIVE_ROOT, live repo: $LIVE_REPO, build dir: $BUILD_DIR"
mkdir -p $REPORT_DIR
rm $REPORT_FILE
echo "reporting to $REPORT_FILE" 2>&1 | tee -a $REPORT_FILE
echo "Building $GIT_COMMIT_MESSAGE" 2>&1 | tee -a $REPORT_FILE
echo "Live branch: $GIT_LIVE_BRANCH" 2>&1 | tee -a $REPORT_FILE
echo "Temp dirs: $MIGRATE_DIR, $SPHINX_DIR, $REPO_DIR" 2>&1 | tee -a $REPORT_FILE
echo "Live root: $LIVE_ROOT, live repo: $LIVE_REPO, build dir: $BUILD_DIR, report dir: $REPORT_DIR" 2>&1 | tee -a $REPORT_FILE

echo "Migrate Godot to Redot, options $1"
echo "Delete temps" 2>&1 | tee -a $REPORT_FILE
rm -rf $MIGRATE_DIR 2>&1 | tee -a $REPORT_FILE
rm -rf $SPHINX_DIR 2>&1 | tee -a $REPORT_FILE
rm -rf $REPO_DIR 2>&1 | tee -a $REPORT_FILE

echo "Migrate Godot to Redot, options $1" 2>&1 | tee -a $REPORT_FILE
mkdir -p $MIGRATE_DIR
python migrate.py $1 $INPUT_DIR $MIGRATE_DIR
python migrate.py $1 $INPUT_DIR $MIGRATE_DIR 2>&1 | tee -a $REPORT_FILE

echo "Translate to html"
mkdir -p $SPHINX_DIR
sphinx-build -b html -j 4 $MIGRATE_DIR $SPHINX_DIR
sphinx-build -b html -j 4 $MIGRATE_DIR $SPHINX_DIR 2>&1 | tee -a $REPORT_FILE

echo "Cloning $LIVE_REPO $REPO_DIR"
git clone $LIVE_REPO $REPO_DIR
git clone $LIVE_REPO $REPO_DIR 2>&1 | tee -a $REPORT_FILE

echo "Checking out $GIT_LIVE_BRANCH"
cd $REPO_DIR
git checkout $GIT_LIVE_BRANCH
git checkout $GIT_LIVE_BRANCH 2>&1 | tee -a $REPORT_FILE
echo "mkdir -p $BUILD_DIR"
mkdir -p $BUILD_DIR
echo "cp -r ../$SPHINX_DIR/* $BUILD_DIR"
cp -r ../$SPHINX_DIR/* $BUILD_DIR

echo "Commit and push to $GIT_REMOTE_BRANCH, with message $GIT_COMMIT_MESSAGE"
git add .
git commit -m "$GIT_COMMIT_MESSAGE"
git push -f
echo "cp -r ../$SPHINX_DIR/* $BUILD_DIR" 2>&1 | tee -a $REPORT_FILE
cp -r ../$SPHINX_DIR/* $BUILD_DIR 2>&1 | tee -a $REPORT_FILE

echo "Delete temps"
rm -rf $MIGRATE_DIR
rm -rf $SPHINX_DIR
rm -rf $REPO_DIR
echo "Commit and push to $GIT_REMOTE_BRANCH, with message $GIT_COMMIT_MESSAGE" 2>&1 | tee -a $REPORT_FILE
git add . 2>&1 | tee -a $REPORT_FILE
git commit -m "$GIT_COMMIT_MESSAGE" 2>&1 | tee -a $REPORT_FILE
git push -f 2>&1 | tee -a $REPORT_FILE

echo "Done. Made by @Craptain"
echo "Done. Made by @Craptain" 2>&1 | tee -a $REPORT_FILE

0 comments on commit 9995218

Please sign in to comment.