-
Notifications
You must be signed in to change notification settings - Fork 243
85 lines (80 loc) · 2.93 KB
/
deploy.yml
File metadata and controls
85 lines (80 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Deploy
permissions:
contents: read
actions: read
on:
workflow_dispatch:
inputs:
version:
description: 'Write the Theme version that sis about to get released to Production WordPress.org SVN'
required: true
type: string
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Validate branch name
run: |
BRANCH_NAME="${{ github.ref_name }}"
if [[ ! "$BRANCH_NAME" =~ ^[0-9]+\.[0-9]+ ]]; then
echo "::error::Branch name must match pattern (e.g., 3.4, 3.5). Current branch: $BRANCH_NAME"
exit 1
fi
- name: Validate version input
run: |
PACKAGE_VERSION=$(cat package.json | jq -r '.version')
INPUT_VERSION="${{ inputs.version }}"
if [ "$INPUT_VERSION" != "$PACKAGE_VERSION" ]; then
echo "::error::Input version ($INPUT_VERSION) does not match package.json version ($PACKAGE_VERSION)"
exit 1
fi
build:
needs: validate
if: ( github.actor == 'ManorHazaz' || github.actor == 'hein-obox' || github.actor == 'KingYes' || github.actor == 'arielk' || github.actor == 'nicoladj77' ) && startsWith( github.repository, 'elementor/' )
uses: ./.github/workflows/build.yml
secrets: inherit
deploy:
needs: [validate, build]
if: needs.validate.result == 'success' && needs.build.result == 'success'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Preparing envs
run: |
echo "THEME_VERSION=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: hello-elementor
- name: Extract Hello Theme build
run: |
HT_ZIP=$(find . -name "hello-elementor-*.zip" -o -name "hello-elementor.*.zip" -type f | head -1)
unzip -q "$HT_ZIP" -d ./tmp/
mv ./tmp/hello-elementor ./hello-elementor
rm -rf ./tmp
- name: Validate changelog
env:
VERSION: ${{ env.THEME_VERSION }}
run: |
bash "${GITHUB_WORKSPACE}/.github/scripts/validate-changelog.sh"
- name: Install SVN
run: |
sudo apt-get update -y
sudo apt-get install -y subversion
which svn
svn --version
- name: Publish to WordPress.org SVN
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
run: |
bash "${GITHUB_WORKSPACE}/.github/scripts/publish-theme-to-wordpress-org.sh"
- name: Send Slack Notification
uses: ./.github/actions/theme-slack-notification-release
with:
CLOUD_SLACK_BOT_TOKEN: ${{ secrets.CLOUD_SLACK_BOT_TOKEN }}
PACKAGE_VERSION: ${{ env.THEME_VERSION }}
SLACK_CHANNEL: "#tmz-hello-delivery"