diff --git a/.gitignore b/.gitignore index 2e2df35cecfd..964689a45725 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ _build/ _build-old/ _migrated/ +_sphinx/ +_repo/ env/ __pycache__ *.pyc diff --git a/build.sh b/build.sh index 25950f600fb1..5c82a1daebce 100755 --- a/build.sh +++ b/build.sh @@ -1,30 +1,51 @@ #!/bin/bash +GIT_BRANCH=`git rev-parse --abbrev-ref HEAD` +DATE=`date` +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" -BUILD_ROOT="redot-docs-build" -BUILD_DIR="$BUILD_ROOT/en/master" +LIVE_ROOT="redot-docs-live" +LIVE_REPO="git@github.com:Redot-Engine/$LIVE_ROOT.git" +BUILD_DIR="html/en/$GIT_BRANCH" -touch test.txt -echo 'hello' >> test.txt +echo "Live root: $LIVE_ROOT, live repo: $LIVE_REPO, build dir: $BUILD_DIR" +echo "Migrate Godot to Redot, options $1" mkdir -p $MIGRATE_DIR -python migrate.py --tiny $INPUT_DIR $MIGRATE_DIR +python migrate.py $1 $INPUT_DIR $MIGRATE_DIR + +echo "Translate to html" mkdir -p $SPHINX_DIR sphinx-build -b html -j 4 $MIGRATE_DIR $SPHINX_DIR -git clone git@github.com:Redot-Engine/$BUILD_ROOT.git +echo "Cloning $LIVE_REPO $REPO_DIR" +git clone $LIVE_REPO $REPO_DIR +echo "Checking out $GIT_LIVE_BRANCH" +cd $REPO_DIR +git checkout $GIT_LIVE_BRANCH echo "mkdir -p $BUILD_DIR" mkdir -p $BUILD_DIR -echo "cp -r $SPHINX_DIR/* $BUILD_DIR" -cp -r $SPHINX_DIR/* $BUILD_DIR - -cp test.txt $BUILD_DIR -cp test.txt $BUILD_DIR/index.html +echo "cp -r ../$SPHINX_DIR/* $BUILD_DIR" +cp -r ../$SPHINX_DIR/* $BUILD_DIR -cd $BUILD_DIR -ls -la +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 "Delete temps" +rm -rf $MIGRATE_DIR +rm -rf $SPHINX_DIR +rm -rf $REPO_DIR + +echo "Done. Made by @Craptain"