Skip to content

Commit 5444eeb

Browse files
fix: resolve lint failures and activate Elementor in test flow
Apply Prettier formatting to release-tag-creation files and version-files utilities. Remove unnecessary regex escape in version-files.ts. Activate Elementor plugin in setup-elementor-env instead of only validating it, fixing the Performance flow CI job where wp-env installs but does not auto-activate plugins. Ref: ED-24451 Co-authored-by: Netanel Baba <Ntnelbaba@users.noreply.github.com>
1 parent 39d20b6 commit 5444eeb

6 files changed

Lines changed: 205 additions & 163 deletions

File tree

actions/release-tag-creation/action.yml

Lines changed: 134 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -2,150 +2,150 @@ name: Release Tag Creation
22
description: Validates the version, bumps version files, creates and pushes a git release tag.
33

44
inputs:
5-
version:
6-
required: true
7-
description: 'Version to release (e.g. 4.1.0-beta1 or 4.0.11).'
8-
dry_run:
9-
required: false
10-
default: 'true'
11-
description: 'Dry run — validate everything but do not push commits or create tag.'
12-
maintain_username:
13-
required: true
14-
description: 'Git user.name for the version-bump commit.'
15-
maintain_email:
16-
required: true
17-
description: 'Git user.email for the version-bump commit.'
5+
version:
6+
required: true
7+
description: 'Version to release (e.g. 4.1.0-beta1 or 4.0.11).'
8+
dry_run:
9+
required: false
10+
default: 'true'
11+
description: 'Dry run — validate everything but do not push commits or create tag.'
12+
maintain_username:
13+
required: true
14+
description: 'Git user.name for the version-bump commit.'
15+
maintain_email:
16+
required: true
17+
description: 'Git user.email for the version-bump commit.'
1818

1919
outputs:
20-
channel:
21-
description: 'The release channel: stable or beta.'
22-
value: ${{ steps.handle-version-input.outputs.channel }}
23-
checkout_branch:
24-
description: 'The branch the version bump was applied to.'
25-
value: ${{ steps.handle-version-input.outputs.checkout_branch }}
26-
tag_pushed:
27-
description: 'Whether the tag was pushed (true/false).'
28-
value: ${{ steps.create-release-tag.outputs.tag_pushed }}
29-
readme_stable_tag:
30-
description: 'The Stable tag value written to readme.txt.'
31-
value: ${{ steps.capture-readme.outputs.readme_stable_tag }}
32-
readme_beta_tag:
33-
description: 'The Beta tag value written to readme.txt.'
34-
value: ${{ steps.capture-readme.outputs.readme_beta_tag }}
20+
channel:
21+
description: 'The release channel: stable or beta.'
22+
value: ${{ steps.handle-version-input.outputs.channel }}
23+
checkout_branch:
24+
description: 'The branch the version bump was applied to.'
25+
value: ${{ steps.handle-version-input.outputs.checkout_branch }}
26+
tag_pushed:
27+
description: 'Whether the tag was pushed (true/false).'
28+
value: ${{ steps.create-release-tag.outputs.tag_pushed }}
29+
readme_stable_tag:
30+
description: 'The Stable tag value written to readme.txt.'
31+
value: ${{ steps.capture-readme.outputs.readme_stable_tag }}
32+
readme_beta_tag:
33+
description: 'The Beta tag value written to readme.txt.'
34+
value: ${{ steps.capture-readme.outputs.readme_beta_tag }}
3535

3636
runs:
37-
using: composite
38-
steps:
39-
- name: Install dependencies
40-
shell: bash
41-
env:
42-
ACTION_PATH: ${{ github.action_path }}
43-
run: npm install --prefix "$ACTION_PATH"
37+
using: composite
38+
steps:
39+
- name: Install dependencies
40+
shell: bash
41+
env:
42+
ACTION_PATH: ${{ github.action_path }}
43+
run: npm install --prefix "$ACTION_PATH"
4444

45-
- name: Handle version input
46-
id: handle-version-input
47-
shell: bash
48-
env:
49-
INPUT_VERSION: ${{ inputs.version }}
50-
ACTION_PATH: ${{ github.action_path }}
51-
run: node "$ACTION_PATH/main.ts"
45+
- name: Handle version input
46+
id: handle-version-input
47+
shell: bash
48+
env:
49+
INPUT_VERSION: ${{ inputs.version }}
50+
ACTION_PATH: ${{ github.action_path }}
51+
run: node "$ACTION_PATH/main.ts"
5252

53-
- name: Switch to release branch
54-
shell: bash
55-
env:
56-
CHECKOUT_BRANCH: ${{ steps.handle-version-input.outputs.checkout_branch }}
57-
CHECKOUT_SHA: ${{ github.sha }}
58-
run: |
59-
git checkout "${CHECKOUT_BRANCH}"
60-
git checkout "${CHECKOUT_SHA}" -- .github/
53+
- name: Switch to release branch
54+
shell: bash
55+
env:
56+
CHECKOUT_BRANCH: ${{ steps.handle-version-input.outputs.checkout_branch }}
57+
CHECKOUT_SHA: ${{ github.sha }}
58+
run: |
59+
git checkout "${CHECKOUT_BRANCH}"
60+
git checkout "${CHECKOUT_SHA}" -- .github/
6161
62-
- name: Config git user
63-
shell: bash
64-
env:
65-
GIT_USER_NAME: ${{ inputs.maintain_username }}
66-
GIT_USER_EMAIL: ${{ inputs.maintain_email }}
67-
run: |
68-
git config --global user.name "${GIT_USER_NAME}"
69-
git config --global user.email "${GIT_USER_EMAIL}"
62+
- name: Config git user
63+
shell: bash
64+
env:
65+
GIT_USER_NAME: ${{ inputs.maintain_username }}
66+
GIT_USER_EMAIL: ${{ inputs.maintain_email }}
67+
run: |
68+
git config --global user.name "${GIT_USER_NAME}"
69+
git config --global user.email "${GIT_USER_EMAIL}"
7070
71-
- name: Update version files
72-
id: capture-readme
73-
shell: bash
74-
env:
75-
INPUT_VERSION: ${{ inputs.version }}
76-
INPUT_CHANNEL: ${{ steps.handle-version-input.outputs.channel }}
77-
INPUT_COMPANION_TAG: ${{ steps.handle-version-input.outputs.companion_tag }}
78-
ACTION_PATH: ${{ github.action_path }}
79-
run: node "$ACTION_PATH/update-version-files.ts"
71+
- name: Update version files
72+
id: capture-readme
73+
shell: bash
74+
env:
75+
INPUT_VERSION: ${{ inputs.version }}
76+
INPUT_CHANNEL: ${{ steps.handle-version-input.outputs.channel }}
77+
INPUT_COMPANION_TAG: ${{ steps.handle-version-input.outputs.companion_tag }}
78+
ACTION_PATH: ${{ github.action_path }}
79+
run: node "$ACTION_PATH/update-version-files.ts"
8080

81-
- name: Commit version bump
82-
shell: bash
83-
env:
84-
VERSION: ${{ inputs.version }}
85-
DRY_RUN: ${{ inputs.dry_run }}
86-
run: |
87-
if [[ "${DRY_RUN}" == "true" ]]; then
88-
echo "Dry run — skipping commit."
89-
exit 0
90-
fi
91-
git add elementor.php readme.txt
92-
if git diff --cached --quiet; then
93-
echo "No changes to commit — version files already at ${VERSION}."
94-
exit 0
95-
fi
96-
git commit -m "Bump version to ${VERSION}"
97-
echo "Committed version bump to ${VERSION}."
81+
- name: Commit version bump
82+
shell: bash
83+
env:
84+
VERSION: ${{ inputs.version }}
85+
DRY_RUN: ${{ inputs.dry_run }}
86+
run: |
87+
if [[ "${DRY_RUN}" == "true" ]]; then
88+
echo "Dry run — skipping commit."
89+
exit 0
90+
fi
91+
git add elementor.php readme.txt
92+
if git diff --cached --quiet; then
93+
echo "No changes to commit — version files already at ${VERSION}."
94+
exit 0
95+
fi
96+
git commit -m "Bump version to ${VERSION}"
97+
echo "Committed version bump to ${VERSION}."
9898
99-
- name: Create release tag
100-
id: create-release-tag
101-
shell: bash
102-
env:
103-
VERSION: ${{ inputs.version }}
104-
DRY_RUN: ${{ inputs.dry_run }}
105-
run: |
106-
if [[ "${DRY_RUN}" == "true" ]]; then
107-
echo "Dry run — skipping tag push."
108-
echo "tag_pushed=false" >> "$GITHUB_OUTPUT"
109-
else
110-
git tag -a "${VERSION}" -m "Release version ${VERSION}"
111-
git push origin "${VERSION}"
112-
echo "Release tag ${VERSION} pushed successfully (branch unchanged)."
113-
echo "tag_pushed=true" >> "$GITHUB_OUTPUT"
114-
fi
99+
- name: Create release tag
100+
id: create-release-tag
101+
shell: bash
102+
env:
103+
VERSION: ${{ inputs.version }}
104+
DRY_RUN: ${{ inputs.dry_run }}
105+
run: |
106+
if [[ "${DRY_RUN}" == "true" ]]; then
107+
echo "Dry run — skipping tag push."
108+
echo "tag_pushed=false" >> "$GITHUB_OUTPUT"
109+
else
110+
git tag -a "${VERSION}" -m "Release version ${VERSION}"
111+
git push origin "${VERSION}"
112+
echo "Release tag ${VERSION} pushed successfully (branch unchanged)."
113+
echo "tag_pushed=true" >> "$GITHUB_OUTPUT"
114+
fi
115115
116-
- name: Write job summary
117-
shell: bash
118-
env:
119-
DRY_RUN: ${{ inputs.dry_run }}
120-
TAG_PUSHED: ${{ steps.create-release-tag.outputs.tag_pushed }}
121-
CHANNEL: ${{ steps.handle-version-input.outputs.channel }}
122-
BRANCH: ${{ steps.handle-version-input.outputs.checkout_branch }}
123-
STABLE_TAG: ${{ steps.capture-readme.outputs.readme_stable_tag }}
124-
BETA_TAG: ${{ steps.capture-readme.outputs.readme_beta_tag }}
125-
VERSION: ${{ inputs.version }}
126-
run: |
127-
if [[ "${DRY_RUN}" == "true" ]]; then
128-
MODE_BADGE="🔵 Dry Run"
129-
else
130-
MODE_BADGE="🚀 Live"
131-
fi
116+
- name: Write job summary
117+
shell: bash
118+
env:
119+
DRY_RUN: ${{ inputs.dry_run }}
120+
TAG_PUSHED: ${{ steps.create-release-tag.outputs.tag_pushed }}
121+
CHANNEL: ${{ steps.handle-version-input.outputs.channel }}
122+
BRANCH: ${{ steps.handle-version-input.outputs.checkout_branch }}
123+
STABLE_TAG: ${{ steps.capture-readme.outputs.readme_stable_tag }}
124+
BETA_TAG: ${{ steps.capture-readme.outputs.readme_beta_tag }}
125+
VERSION: ${{ inputs.version }}
126+
run: |
127+
if [[ "${DRY_RUN}" == "true" ]]; then
128+
MODE_BADGE="🔵 Dry Run"
129+
else
130+
MODE_BADGE="🚀 Live"
131+
fi
132132
133-
if [[ "${TAG_PUSHED}" == "true" ]]; then
134-
TAG_STATUS="✅ Pushed"
135-
else
136-
TAG_STATUS="⏭️ Skipped (dry run)"
137-
fi
133+
if [[ "${TAG_PUSHED}" == "true" ]]; then
134+
TAG_STATUS="✅ Pushed"
135+
else
136+
TAG_STATUS="⏭️ Skipped (dry run)"
137+
fi
138138
139-
{
140-
echo "## Release Tag Creation Report"
141-
echo ""
142-
echo "| Field | Value |"
143-
echo "| --- | --- |"
144-
echo "| **Mode** | ${MODE_BADGE} |"
145-
echo "| **Version** | \`${VERSION}\` |"
146-
echo "| **Channel** | ${CHANNEL} |"
147-
echo "| **Branch** | \`${BRANCH}\` |"
148-
echo "| **Tag pushed** | ${TAG_STATUS} |"
149-
echo "| **readme.txt stable tag** | \`${STABLE_TAG}\` |"
150-
echo "| **readme.txt beta tag** | \`${BETA_TAG}\` |"
151-
} >> "$GITHUB_STEP_SUMMARY"
139+
{
140+
echo "## Release Tag Creation Report"
141+
echo ""
142+
echo "| Field | Value |"
143+
echo "| --- | --- |"
144+
echo "| **Mode** | ${MODE_BADGE} |"
145+
echo "| **Version** | \`${VERSION}\` |"
146+
echo "| **Channel** | ${CHANNEL} |"
147+
echo "| **Branch** | \`${BRANCH}\` |"
148+
echo "| **Tag pushed** | ${TAG_STATUS} |"
149+
echo "| **readme.txt stable tag** | \`${STABLE_TAG}\` |"
150+
echo "| **readme.txt beta tag** | \`${BETA_TAG}\` |"
151+
} >> "$GITHUB_STEP_SUMMARY"

actions/release-tag-creation/update-version-files.ts

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,25 @@ function patchPhpVersion(content: string, version: string): string {
66
.replace(/(define\( 'ELEMENTOR_VERSION', ')[^']*'/, `$1${version}'`);
77
}
88

9-
function patchReadmeTxt(content: string, tags: { stable: string; beta: string }): string {
9+
function patchReadmeTxt(
10+
content: string,
11+
tags: { stable: string; beta: string },
12+
): string {
1013
if (!content.match(/^Stable tag: /m)) {
11-
throw new Error('patchReadmeTxt: "Stable tag:" line not found in readme.txt');
14+
throw new Error(
15+
'patchReadmeTxt: "Stable tag:" line not found in readme.txt',
16+
);
1217
}
1318
if (!content.match(/^Beta tag: /m)) {
14-
throw new Error('patchReadmeTxt: "Beta tag:" line not found in readme.txt');
19+
throw new Error(
20+
'patchReadmeTxt: "Beta tag:" line not found in readme.txt',
21+
);
1522
}
1623
return content
1724
.replace(/^Stable tag: .*/m, `Stable tag: ${tags.stable}`)
1825
.replace(/^Beta tag: .*/m, `Beta tag: ${tags.beta}`);
1926
}
2027

21-
2228
export function resolveReadmeTags(
2329
version: string,
2430
channel: string,
@@ -55,17 +61,25 @@ export function run(): void {
5561

5662
// ── elementor.php ────────────────────────────────────────────────────────
5763
const phpPath = 'elementor.php';
58-
const patchedPhp = patchPhpVersion(readFileSync(phpPath, 'utf8'), version);
64+
const patchedPhp = patchPhpVersion(
65+
readFileSync(phpPath, 'utf8'),
66+
version,
67+
);
5968
writeFileSync(phpPath, patchedPhp, 'utf8');
6069
console.log(`✅ elementor.php patched to ${version}`);
6170

6271
// ── readme.txt ───────────────────────────────────────────────────────────
6372
const readmePath = 'readme.txt';
6473
const readmeTags = resolveReadmeTags(version, channel, companionTag);
6574

66-
const patchedReadme = patchReadmeTxt(readFileSync(readmePath, 'utf8'), readmeTags);
75+
const patchedReadme = patchReadmeTxt(
76+
readFileSync(readmePath, 'utf8'),
77+
readmeTags,
78+
);
6779
writeFileSync(readmePath, patchedReadme, 'utf8');
68-
console.log(`✅ readme.txt patched — Stable: ${readmeTags.stable}, Beta: ${readmeTags.beta}`);
80+
console.log(
81+
`✅ readme.txt patched — Stable: ${readmeTags.stable}, Beta: ${readmeTags.beta}`,
82+
);
6983

7084
// ── outputs ──────────────────────────────────────────────────────────────
7185
setOutput('readme_stable_tag', readmeTags.stable);

actions/setup-elementor-env/dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

actions/setup-elementor-env/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ export async function run() {
2121
});
2222
});
2323

24-
await core.group('Validating elementor being activated', async () => {
24+
await core.group('Activating Elementor', async () => {
2525
await runOnContainer({
2626
container,
27-
command: ['wp', 'plugin', 'is-active', 'elementor'],
28-
error: "Can't find an active Elementor installation. Please make sure it's installed and activated.",
27+
command: ['wp', 'plugin', 'activate', 'elementor'],
28+
error: "Can't activate Elementor. Please make sure it's installed.",
2929
});
3030
});
3131

0 commit comments

Comments
 (0)