11#! /bin/bash
22set -eo pipefail
33
4- echo " 🧪 DRY RUN MODE: Will simulate SVN operations without committing"
4+ echo " DRY RUN MODE: Will simulate SVN operations without committing"
55
66if [[ -z " $THEME_VERSION " ]]; then
77 echo " Set the THEME_VERSION env var"
88 exit 1
99fi
1010
11- if [[ -z " $THEME_SLUG " ]]; then
12- echo " Set the THEME_SLUG env var"
13- exit 1
14- fi
15-
16- if [[ -z " $BUILD_DIR " ]]; then
17- echo " Set the BUILD_DIR env var"
18- exit 1
19- fi
20-
2111# Ensure SVN is installed
2212svn --version
2313
2414echo " SVN installed"
2515
2616echo " Publish theme version: ${THEME_VERSION} "
27- echo " Theme slug: ${THEME_SLUG} "
28- echo " Build directory: ${BUILD_DIR} "
2917
3018THEME_PATH=" $GITHUB_WORKSPACE "
3119SVN_PATH=" $GITHUB_WORKSPACE /svn"
3624mkdir -p $SVN_PATH
3725cd $SVN_PATH
3826
39- echo " 🧪 DRY RUN: Checking out SVN repository (read-only)"
40- svn co --depth immediates " https://themes.svn.wordpress.org/${THEME_SLUG} " . 2>&1 | head -20 || {
41- echo " ⚠️ Could not checkout repository (may require auth for some operations)"
42- echo " This is normal - simulating checkout for dry-run"
27+ echo " DRY RUN: Checking out SVN repository (read-only)"
28+ svn co --depth immediates " https://themes.svn.wordpress.org/hello-elementor " . 2>&1 | head -20 || {
29+ echo " Could not checkout repository (may require auth for some operations)"
30+ echo " This is normal - simulating checkout for dry-run"
4331 mkdir -p " $VERSION_DIR "
4432 cd " $VERSION_DIR "
4533}
4634
4735echo " Check if version folder already exists"
4836VERSION_EXISTS=false
49- if svn list " https://themes.svn.wordpress.org/${THEME_SLUG} /${VERSION_DIR} " > /dev/null 2>&1 ; then
37+ if svn list " https://themes.svn.wordpress.org/hello-elementor /${VERSION_DIR} " > /dev/null 2>&1 ; then
5038 VERSION_EXISTS=true
5139fi
5240
5341if [[ " $VERSION_EXISTS " == " true" ]]; then
54- echo " ❌ ERROR: Version folder $VERSION_DIR already exists in SVN!
55- SVN URL: https://themes.svn.wordpress.org/${THEME_SLUG} /${VERSION_DIR}
42+ echo " ERROR: Version folder $VERSION_DIR already exists in SVN!
43+ SVN URL: https://themes.svn.wordpress.org/hello-elementor /${VERSION_DIR}
5644
5745 WordPress.org theme versions are immutable - you cannot update an existing version.
5846 If you need to make changes, create a new version (e.g., increment patch/minor/major).
5947
60- 🧪 DRY RUN: Would fail here (version already exists)"
48+ DRY RUN: Would fail here (version already exists)"
6149 exit 0
6250fi
6351
6452mkdir -p " $VERSION_DIR "
6553cd " $VERSION_DIR "
6654
6755echo " Copy files from build directory"
68- rsync -ah --progress " $THEME_PATH /$BUILD_DIR /" * . || rsync -ah --progress " $THEME_PATH /$BUILD_DIR /." . || true
56+ rsync -ah --progress " $THEME_PATH /hello-elementor /" * . || rsync -ah --progress " $THEME_PATH /hello-elementor /." . || true
6957
7058echo " Preparing files for SVN"
7159svn status 2> /dev/null || echo " "
7260
7361echo " svn add new files"
74- echo " 🧪 DRY RUN: Would add new files"
62+ echo " DRY RUN: Would add new files"
7563svn status 2> /dev/null | grep -v ' ^.[ \t]*\\..*' | { grep ' ^?' || true ; } | awk ' {print $2}' | sed ' s|^| Would add: |' || true
7664
7765echo " "
@@ -87,36 +75,36 @@ if [ -n "$SVN_STATUS" ]; then
8775 MODIFIED_COUNT=$( echo " $SVN_STATUS " | grep -c " ^M" || echo " 0" )
8876 UNTRACKED_COUNT=$( echo " $SVN_STATUS " | grep -c " ^?" || echo " 0" )
8977
90- echo " Added (A): $ADDED_COUNT files"
78+ echo " Added (A): $ADDED_COUNT files"
9179 if [ " $MODIFIED_COUNT " -gt 0 ]; then
92- echo " Modified (M): $MODIFIED_COUNT files"
80+ echo " Modified (M): $MODIFIED_COUNT files"
9381 fi
9482 if [ " $UNTRACKED_COUNT " -gt 0 ]; then
95- echo " ⚠️ Untracked (?): $UNTRACKED_COUNT files (would be added)"
83+ echo " Untracked (?): $UNTRACKED_COUNT files (would be added)"
9684 fi
9785 echo " "
9886 TOTAL_CHANGES=$(( ADDED_COUNT + MODIFIED_COUNT))
99- echo " Total files that would be committed: $TOTAL_CHANGES files"
87+ echo " Total files that would be committed: $TOTAL_CHANGES files"
10088else
101- echo " (No changes detected - files are up to date)"
89+ echo " (No changes detected - files are up to date)"
10290fi
10391echo " =========================================="
10492echo " "
10593
10694if [ " $TOTAL_CHANGES " -gt 0 ]; then
107- echo " 🧪 DRY RUN: Would commit $TOTAL_CHANGES files to version folder $VERSION_DIR "
108- echo " Commit message: Upload v${THEME_VERSION} "
95+ echo " DRY RUN: Would commit $TOTAL_CHANGES files to version folder $VERSION_DIR "
96+ echo " Commit message: Upload v${THEME_VERSION} "
10997else
110- echo " 🧪 DRY RUN: No changes to commit (files are up to date)"
98+ echo " DRY RUN: No changes to commit (files are up to date)"
11199fi
112- echo " 🚫 No actual commit performed (dry-run mode)"
100+ echo " No actual commit performed (dry-run mode)"
113101
114102echo " Remove the SVN folder from the workspace"
115103rm -rf $SVN_PATH
116104
117105echo " Back to the workspace root"
118106cd $GITHUB_WORKSPACE
119107
120- echo " ✅ Dry-run complete: v${THEME_VERSION} "
121- echo " All checks passed - ready for actual deployment"
108+ echo " Dry-run complete: v${THEME_VERSION} "
109+ echo " All checks passed - ready for actual deployment"
122110
0 commit comments