Skip to content

Commit 30d049c

Browse files
committed
Update publish theme to WordPress script
1 parent ab9648f commit 30d049c

File tree

3 files changed

+19
-130
lines changed

3 files changed

+19
-130
lines changed

.github/scripts/publish-theme-to-wordpress-org-dry-run.sh

Lines changed: 0 additions & 98 deletions
This file was deleted.

.github/scripts/publish-theme-to-wordpress-org.sh

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
#!/bin/bash
22
set -eo pipefail
33

4-
if [[ -z "$SVN_USERNAME" ]]; then
5-
echo "Set the SVN_USERNAME secret"
6-
exit 1
7-
fi
8-
9-
if [[ -z "$SVN_PASSWORD" ]]; then
10-
echo "Set the SVN_PASSWORD secret"
11-
exit 1
12-
fi
13-
144
if [[ -z "$THEME_VERSION" ]]; then
155
echo "Set the THEME_VERSION env var"
166
exit 1
@@ -46,26 +36,35 @@ if svn list "https://themes.svn.wordpress.org/hello-elementor/${VERSION_DIR}" >
4636
fi
4737

4838
mkdir -p "$VERSION_DIR"
49-
cd "$VERSION_DIR"
50-
cd ..
51-
svn add "$VERSION_DIR"
52-
cd "$VERSION_DIR"
5339

54-
echo "Copy files"
55-
rsync -ah --progress "$THEME_PATH/hello-elementor/"* . || rsync -ah --progress "$THEME_PATH/hello-elementor/." . || true
40+
echo "Copy files from build directory"
41+
rsync -ah --progress "$THEME_PATH/hello-elementor/"* "$VERSION_DIR"
5642

57-
echo "Preparing files"
5843
cd "$VERSION_DIR"
5944

45+
echo "svn delete"
46+
svn status | grep -v '^.[ \t]*\\..*' | { grep '^!' || true; } | awk '{print $2}' | xargs -r svn delete
47+
6048
echo "svn add"
61-
svn status | grep -v '^.[ \t]*\\..*' | { grep '^?' || true; } | awk '{print $2}' | xargs -r svn add || true
49+
svn status | grep -v '^.[ \t]*\\..*' | { grep '^?' || true; } | awk '{print $2}' | xargs -r svn add
6250

51+
echo "Print SVN Status changes"
6352
svn status
6453

54+
cd $SVN_PATH
55+
56+
if [[ -z "$SVN_USERNAME" ]]; then
57+
echo "Set the SVN_USERNAME secret"
58+
exit 1
59+
fi
60+
61+
if [[ -z "$SVN_PASSWORD" ]]; then
62+
echo "Set the SVN_PASSWORD secret"
63+
exit 1
64+
fi
65+
6566
echo "Commit files to version folder $VERSION_DIR"
6667
svn ci -m "Upload v${THEME_VERSION}" --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD"
67-
68-
cd $SVN_PATH
6968
svn update
7069

7170
echo "Remove the SVN folder from the workspace"

.github/workflows/deploy.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ permissions:
66

77
on:
88
workflow_dispatch:
9-
inputs:
10-
dry_run:
11-
type: boolean
12-
description: 'Dry run mode (test without deploying)'
13-
required: false
14-
default: false
159

1610
jobs:
1711
build:
@@ -50,19 +44,13 @@ jobs:
5044
sudo apt-get install -y subversion
5145
which svn
5246
svn --version
53-
- name: Publish to WordPress.org SVN (Dry Run)
54-
if: ${{ inputs.dry_run == true }}
55-
run: |
56-
bash "${GITHUB_WORKSPACE}/.github/scripts/publish-theme-to-wordpress-org-dry-run.sh"
5747
- name: Publish to WordPress.org SVN
58-
if: ${{ inputs.dry_run == false }}
5948
env:
6049
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
6150
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
6251
run: |
6352
bash "${GITHUB_WORKSPACE}/.github/scripts/publish-theme-to-wordpress-org.sh"
6453
- name: Send Slack Notification
65-
if: ${{ inputs.dry_run == false }}
6654
uses: ./.github/actions/theme-slack-notification-release
6755
with:
6856
CLOUD_SLACK_BOT_TOKEN: ${{ secrets.CLOUD_SLACK_BOT_TOKEN }}

0 commit comments

Comments
 (0)