Update Script WordPress.org Plugins

Tech Articles | July 18, 2025 | Uncategorized

One of the last parts of my workflow to automate has been SVN pushes to the WordPress.org repo, i still have two plugins on WordPress.org and they are webhooks-for-bricks-forms & hooksure they both do similar things send form data over webhook.

Almost all my free plugins moving forward and now are served by GitHub and use my UUPD WordPress Updater Solution to serve updates right in your dashboard for free.

I still have to maintain and work on these plugins although there basic plugins and functionality remains reasonably stable I have up until recently been doing this manually either on the command line or via tortisesvn, as I needed to update both I decided to spend the time getting a little automation going via bat scripts. I already have one to push updates from GitHub to the SVN trunk so I need to concentrate on publishing them.

Similar to my normal free plugin release script I wanted to this to ask me for a version number update the stable tag in the readme and the php to match the added release and I want it to commit the trunk and then tag a new release with the inputted version number

The working code is below:

@echo off
setlocal enabledelayedexpansion

REM === Configuration ===
set "WORKING_COPY_PATH=C:\Users\Nathan\svn\webhook-for-bricks-forms"
set "TRUNK_PATH=%WORKING_COPY_PATH%\trunk"
set "PLUGIN_FILE=%TRUNK_PATH%\webhook-for-bricks-forms.php"
set "README_FILE=%TRUNK_PATH%\readme.txt"
set "REPO_URL=https://plugins.svn.wordpress.org/webhook-for-bricks-forms"

REM === Extract plugin slug from REPO_URL ===
for %%A in ("%REPO_URL%") do (
    set "PLUGIN_SLUG=%%~nxA"
)

REM === Prompt for version number ===
set /p VERSION="Enter the new version number (e.g. 1.4.2): "

if "%VERSION%"=="" (
    echo Version number is required. Aborting.
    goto end
)

echo === Updating version numbers with PowerShell ===

REM --- Update PHP version line ---
powershell -Command "(Get-Content '%PLUGIN_FILE%') -replace '^(Version:\s*).+$', '${1}%VERSION%' | Set-Content '%PLUGIN_FILE%'" || (
    echo Failed to update version in PHP file. Aborting.
    goto end
)

REM --- Update Stable tag in readme.txt ---
powershell -Command "(Get-Content '%README_FILE%') -replace '^(Stable tag:\s*).+$', '${1}%VERSION%' | Set-Content '%README_FILE%'" || (
    echo Failed to update version in readme.txt. Aborting.
    goto end
)

echo === Committing changes in trunk ===
cd /d "%TRUNK_PATH%"
svn add --force . >nul
svn commit -m "Preparing for version %VERSION% release"
if %ERRORLEVEL% NEQ 0 (
    echo Commit failed. Aborting.
    goto end
)

echo === Tagging version %VERSION% ===
cd /d "%WORKING_COPY_PATH%"
svn copy "%TRUNK_PATH%" "%REPO_URL%/tags/%VERSION%" -m "Tagging version %VERSION% for release"
if %ERRORLEVEL% NEQ 0 (
    echo Tagging failed. Aborting.
    goto end
)

echo === Refreshing plugin page for %PLUGIN_SLUG% ===
start https://wordpress.org/plugins/%PLUGIN_SLUG%/?refresh

echo === Release %VERSION% completed successfully! &#x1f680 ===

:end
pause
endlocal
BAT (Batchfile)

Support the Author

buy me a coffee
Really Useful Plugin Logo
Wpvideobank temp
Appoligies for any spelling and grammer issue. As a dyslexic i need to rely on tools for this they like me are not perfect but I do try my best