Skip to content

Commit a8cd5d7

Browse files
authored
Internal: Fix deploy action [TMZ-1013] (#614) (#615)
* Internal: Fix deploy action [TMZ-1013] * add validation
1 parent 3a885fe commit a8cd5d7

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ mkdir -p "$VERSION_DIR"
4040
echo "Copy files from build directory"
4141
rsync -ah --progress "$THEME_PATH/hello-elementor/"* "$VERSION_DIR"
4242

43-
cd "$VERSION_DIR"
44-
4543
echo "svn delete"
4644
svn status | grep -v '^.[ \t]*\\..*' | { grep '^!' || true; } | awk '{print $2}' | xargs -r svn delete
4745

.github/workflows/deploy.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,43 @@ permissions:
66

77
on:
88
workflow_dispatch:
9+
inputs:
10+
version:
11+
description: 'Write the Theme version that sis about to get released to Production WordPress.org SVN'
12+
required: true
13+
type: string
914

1015
jobs:
16+
validate:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
- name: Validate branch name
22+
run: |
23+
BRANCH_NAME="${{ github.ref_name }}"
24+
if [[ ! "$BRANCH_NAME" =~ ^[0-9]+\.[0-9]+ ]]; then
25+
echo "::error::Branch name must match pattern (e.g., 3.4, 3.5). Current branch: $BRANCH_NAME"
26+
exit 1
27+
fi
28+
- name: Validate version input
29+
run: |
30+
PACKAGE_VERSION=$(cat package.json | jq -r '.version')
31+
INPUT_VERSION="${{ inputs.version }}"
32+
if [ "$INPUT_VERSION" != "$PACKAGE_VERSION" ]; then
33+
echo "::error::Input version ($INPUT_VERSION) does not match package.json version ($PACKAGE_VERSION)"
34+
exit 1
35+
fi
36+
1137
build:
38+
needs: validate
1239
if: ( github.actor == 'ManorHazaz' || github.actor == 'hein-obox' || github.actor == 'KingYes' || github.actor == 'arielk' || github.actor == 'nicoladj77' ) && startsWith( github.repository, 'elementor/' )
1340
uses: ./.github/workflows/build.yml
1441
secrets: inherit
1542

1643
deploy:
17-
needs: build
18-
if: needs.build.result == 'success'
44+
needs: [validate, build]
45+
if: needs.validate.result == 'success' && needs.build.result == 'success'
1946
runs-on: ubuntu-latest
2047
steps:
2148
- name: Checkout repository

0 commit comments

Comments
 (0)