Skip to content

Commit 13d6859

Browse files
authored
Print svn status (#568)
1 parent d3f2020 commit 13d6859

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed

.github/workflows/release.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,110 @@ jobs:
283283
VERSION: ${{ env.PACKAGE_VERSION }}
284284
BUILD_DIR: ./${{ env.CONFIG_THEME_SLUG }}
285285

286+
- name: Show SVN Status (Dry Run)
287+
if: ${{ inputs.dry_run == true && inputs.deploy_to_wporg == true && env.AUTO_DEPLOY_ENABLED == 'true' }}
288+
run: |
289+
echo "📊 **SVN Status Check - Dry Run**"
290+
echo ""
291+
292+
SVN_TEMP_DIR="./svn-checkout-temp"
293+
SVN_URL="https://themes.svn.wordpress.org/${{ env.CONFIG_THEME_SLUG }}"
294+
BUILD_DIR="./${{ env.CONFIG_THEME_SLUG }}"
295+
VERSION="${{ env.PACKAGE_VERSION }}"
296+
297+
echo "🔍 Checking out SVN repository (read-only)..."
298+
echo " - SVN URL: $SVN_URL"
299+
echo " - Version: $VERSION"
300+
echo ""
301+
302+
if ! command -v svn &> /dev/null; then
303+
echo "⚠️ SVN not installed - installing..."
304+
sudo apt-get update && sudo apt-get install -y subversion
305+
fi
306+
307+
rm -rf "$SVN_TEMP_DIR"
308+
svn checkout --depth immediates "$SVN_URL" "$SVN_TEMP_DIR" > /dev/null 2>&1 || {
309+
echo "⚠️ Could not checkout full repository (may require auth for some operations)"
310+
echo " Attempting trunk-only checkout..."
311+
svn checkout --depth infinity "$SVN_URL/trunk" "$SVN_TEMP_DIR/trunk" > /dev/null 2>&1 || {
312+
echo "❌ Could not checkout SVN repository"
313+
echo " This is normal for private repositories - skipping SVN status check"
314+
exit 0
315+
}
316+
}
317+
318+
echo "✅ SVN repository checked out"
319+
echo ""
320+
321+
if [ -d "$SVN_TEMP_DIR/trunk" ]; then
322+
echo "📂 **Simulating deployment to SVN trunk...**"
323+
echo ""
324+
325+
cd "$SVN_TEMP_DIR/trunk"
326+
echo " Current trunk status:"
327+
svn status || echo " (Clean working copy)"
328+
echo ""
329+
330+
if [ -d "$BUILD_DIR" ]; then
331+
echo " Copying build files to trunk (simulation)..."
332+
cp -r "$BUILD_DIR"/* . 2>/dev/null || cp -r "$BUILD_DIR"/. . 2>/dev/null || true
333+
334+
echo ""
335+
echo "📊 **SVN Status After File Copy (what would be committed):**"
336+
SVN_STATUS=$(svn status 2>/dev/null || echo "")
337+
if [ -n "$SVN_STATUS" ]; then
338+
echo "$SVN_STATUS" | head -50
339+
TOTAL_CHANGES=$(echo "$SVN_STATUS" | wc -l)
340+
if [ "$TOTAL_CHANGES" -gt 50 ]; then
341+
echo ""
342+
echo " ... and $((TOTAL_CHANGES - 50)) more changes"
343+
fi
344+
echo ""
345+
echo " Summary:"
346+
echo "$SVN_STATUS" | grep "^A" | wc -l | xargs -I {} echo " Added (A): {} files"
347+
echo "$SVN_STATUS" | grep "^M" | wc -l | xargs -I {} echo " Modified (M): {} files"
348+
echo "$SVN_STATUS" | grep "^D" | wc -l | xargs -I {} echo " Deleted (D): {} files"
349+
echo "$SVN_STATUS" | grep "^?" | wc -l | xargs -I {} echo " Untracked (?): {} files"
350+
else
351+
echo " (No changes detected)"
352+
fi
353+
fi
354+
cd - > /dev/null
355+
echo ""
356+
fi
357+
358+
if [ -d "$SVN_TEMP_DIR/tags/$VERSION" ]; then
359+
echo "🏷️ **Tag $VERSION already exists in SVN:**"
360+
ls -la "$SVN_TEMP_DIR/tags/$VERSION" | head -20
361+
echo ""
362+
echo "⚠️ Warning: Tag v$VERSION already exists in SVN!"
363+
else
364+
echo "🏷️ **Tag $VERSION would be created**"
365+
echo ""
366+
fi
367+
368+
echo "📋 **Build Files Summary:**"
369+
echo " Build directory: $BUILD_DIR"
370+
if [ -d "$BUILD_DIR" ]; then
371+
FILE_COUNT=$(find "$BUILD_DIR" -type f | wc -l)
372+
DIR_COUNT=$(find "$BUILD_DIR" -type d | wc -l)
373+
echo " Total files: $FILE_COUNT"
374+
echo " Total directories: $DIR_COUNT"
375+
echo ""
376+
echo " File structure (first 30 files):"
377+
find "$BUILD_DIR" -type f | head -30 | sed 's|^| |'
378+
if [ "$FILE_COUNT" -gt 30 ]; then
379+
echo " ... and $((FILE_COUNT - 30)) more files"
380+
fi
381+
else
382+
echo " ❌ Build directory not found!"
383+
fi
384+
385+
echo ""
386+
echo "🧹 Cleaning up temporary SVN checkout..."
387+
rm -rf "$SVN_TEMP_DIR"
388+
echo "✅ SVN status check complete"
389+
286390
- name: Deploy to WordPress.org Theme Repository
287391
if: ${{ inputs.dry_run == false && inputs.deploy_to_wporg == true && env.AUTO_DEPLOY_ENABLED == 'true' }}
288392
uses: 10up/action-wordpress-plugin-deploy@stable

0 commit comments

Comments
 (0)