1
0
Fork 0
mirror of https://github.com/elementor/hello-theme.git synced 2026-07-27 14:01:37 +08:00
hello-theme/.github/scripts/publish-theme-to-wordpress-org.sh
Manor Hazaz a8cd5d7403
Some checks failed
Build / Build theme (push) Has been cancelled
Lint / ESLint (push) Has been cancelled
Lint / PHPCS (push) Has been cancelled
PHPUnit / File Diff (push) Has been cancelled
PHPUnit / PHPUnit - WordPress 6.5 - PHP version 7.4 (push) Has been cancelled
PHPUnit / PHPUnit - WordPress 6.6 - PHP version 7.4 (push) Has been cancelled
PHPUnit / PHPUnit - WordPress latest - PHP version 7.4 (push) Has been cancelled
PHPUnit / PHPUnit - WordPress nightly - PHP version 7.4 (push) Has been cancelled
PHPUnit / PHPUnit - WordPress 6.5 - PHP version 8.0 (push) Has been cancelled
PHPUnit / PHPUnit - WordPress 6.6 - PHP version 8.0 (push) Has been cancelled
PHPUnit / PHPUnit - WordPress latest - PHP version 8.0 (push) Has been cancelled
PHPUnit / PHPUnit - WordPress nightly - PHP version 8.0 (push) Has been cancelled
PHPUnit / PHPUnit - WordPress 6.5 - PHP version 8.1 (push) Has been cancelled
PHPUnit / PHPUnit - WordPress 6.6 - PHP version 8.1 (push) Has been cancelled
PHPUnit / PHPUnit - WordPress latest - PHP version 8.1 (push) Has been cancelled
PHPUnit / PHPUnit - WordPress nightly - PHP version 8.1 (push) Has been cancelled
PHPUnit / PHPUnit - WordPress 6.5 - PHP version 8.2 (push) Has been cancelled
PHPUnit / PHPUnit - WordPress 6.6 - PHP version 8.2 (push) Has been cancelled
PHPUnit / PHPUnit - WordPress latest - PHP version 8.2 (push) Has been cancelled
PHPUnit / PHPUnit - WordPress nightly - PHP version 8.2 (push) Has been cancelled
PHPUnit / PHPUnit - WordPress 6.5 - PHP version 8.3 (push) Has been cancelled
PHPUnit / PHPUnit - WordPress 6.6 - PHP version 8.3 (push) Has been cancelled
PHPUnit / PHPUnit - WordPress latest - PHP version 8.3 (push) Has been cancelled
PHPUnit / PHPUnit - WordPress nightly - PHP version 8.3 (push) Has been cancelled
PHPUnit / PHPUnit - Test Results (push) Has been cancelled
Internal: Fix deploy action [TMZ-1013] (#614) (#615)
* Internal: Fix deploy action [TMZ-1013]

* add validation
2026-01-21 13:44:47 +00:00

74 lines
1.9 KiB
Bash
Executable file

#!/bin/bash
set -eo pipefail
if [[ -z "$THEME_VERSION" ]]; then
echo "Set the THEME_VERSION env var"
exit 1
fi
# Ensure SVN is installed
svn --version
echo "SVN installed"
echo "Publish theme version: ${THEME_VERSION}"
THEME_PATH="$GITHUB_WORKSPACE"
SVN_PATH="$GITHUB_WORKSPACE/svn"
VERSION_DIR="${THEME_VERSION}"
cd $THEME_PATH
pwd
mkdir -p $SVN_PATH
cd $SVN_PATH
echo "Checkout from SVN"
svn co --depth immediates "https://themes.svn.wordpress.org/hello-elementor" .
echo "Check if version folder already exists"
if svn list "https://themes.svn.wordpress.org/hello-elementor/${VERSION_DIR}" > /dev/null 2>&1; then
echo "ERROR: Version folder $VERSION_DIR already exists in SVN!
SVN URL: https://themes.svn.wordpress.org/hello-elementor/${VERSION_DIR}
WordPress.org theme versions are immutable - you cannot update an existing version.
If you need to make changes, create a new version (e.g., increment patch/minor/major)."
exit 1
fi
mkdir -p "$VERSION_DIR"
echo "Copy files from build directory"
rsync -ah --progress "$THEME_PATH/hello-elementor/"* "$VERSION_DIR"
echo "svn delete"
svn status | grep -v '^.[ \t]*\\..*' | { grep '^!' || true; } | awk '{print $2}' | xargs -r svn delete
echo "svn add"
svn status | grep -v '^.[ \t]*\\..*' | { grep '^?' || true; } | awk '{print $2}' | xargs -r svn add
echo "Print SVN Status changes"
svn status
cd $SVN_PATH
if [[ -z "$SVN_USERNAME" ]]; then
echo "Set the SVN_USERNAME secret"
exit 1
fi
if [[ -z "$SVN_PASSWORD" ]]; then
echo "Set the SVN_PASSWORD secret"
exit 1
fi
echo "Commit files to version folder $VERSION_DIR"
svn ci -m "Upload v${THEME_VERSION}" --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD"
svn update
echo "Remove the SVN folder from the workspace"
rm -rf $SVN_PATH
echo "Back to the workspace root"
cd $GITHUB_WORKSPACE
echo "Theme deployment complete: v${THEME_VERSION}"