Skip to content

Commit

Permalink
created scripts to easily revert or tag releases in svn repo
Browse files Browse the repository at this point in the history
  • Loading branch information
fatihbalsoy committed Dec 16, 2023
1 parent 3ac23d0 commit 9a79068
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ build/
dist/
logs/
src/languages/*.mo
svn/

# ignore node dependency directories
node_modules/
Expand All @@ -13,4 +14,4 @@ node_modules/
error_log

#ignore docker volumes
volumes/
volumes/
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"dev:docker": "npm run build && docker-compose up -d && npm run watch",
"dev:wasm": "npm run build && concurrently \"wp-now start --path=build/\" \"npm run watch\"",
"mmg": "bash scripts/multilingual_markdown.sh",
"svn:tag": "zsh scripts/svn_create_tag.sh",
"svn:reset": "cd svn/ && svn revert --recursive . && svn cleanup . --remove-unversioned --remove-ignored && cd ..",
"start": "npm run dev:docker",
"stop": "docker-compose down"
},
Expand Down
4 changes: 4 additions & 0 deletions scripts/bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
#

SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"/..
if [[ -z "$SCRIPTPATH" ]]; then
echo "SCRIPTPATH is empty. Exiting..."
exit 1
fi

echo "=============================================================" >> $SCRIPTPATH/logs/out.log >> $SCRIPTPATH/logs/err.log
date >> $SCRIPTPATH/logs/out.log >> $SCRIPTPATH/logs/err.log
Expand Down
46 changes: 46 additions & 0 deletions scripts/svn_create_tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env zsh

#
# svn_create_tag.sh
# material-board
#
# Created by Fatih Balsoy on 15 Dec 2023
# Copyright © 2023 Fatih Balsoy. All rights reserved.
#

SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"/..
if [[ -z "$SCRIPTPATH" ]]; then
echo "SCRIPTPATH is empty. Exiting."
exit 1
fi

build_path="$SCRIPTPATH/build/"
svn_path="$SCRIPTPATH/svn/"
if [[ ! -d "$build_path" || ! -d "$svn_path" ]]; then
echo "Build or SVN path does not exist. Exiting."
exit 1
fi

source $SCRIPTPATH/scripts/plugin_info.sh
PLUGIN_ZIP_NAME="${PLUGIN_BUNDLE}-${PLUGIN_VERSION}"
echo "$PLUGIN_ZIP_NAME"

tag_path="$SCRIPTPATH/svn/tags/$PLUGIN_VERSION/"
if [[ -d "$tag_path" ]]; then
echo "Tag for $PLUGIN_VERSION already exists! Exiting."
exit 1
fi

echo "Bundling plugin..."
npm run build

echo "Clearing trunk..."
rm -rf "$SCRIPTPATH/svn/trunk/"
mkdir -p "$SCRIPTPATH/svn/trunk/"
echo "Creating tag..."
mkdir -p "$SCRIPTPATH/svn/tags/$PLUGIN_VERSION"
echo "Copying files..."
cp -ar "$SCRIPTPATH/build/_bundle/$PLUGIN_BUNDLE/." "$SCRIPTPATH/svn/tags/$PLUGIN_VERSION"
cp -ar "$SCRIPTPATH/build/_bundle/$PLUGIN_BUNDLE/." "$SCRIPTPATH/svn/trunk"

echo "Done."

0 comments on commit 9a79068

Please sign in to comment.