Skip to content

Commit 1680b33

Browse files
committed
Merge remote-tracking branch 'origin/core/core-beta' into flat-file
2 parents 8187aab + 5272b5a commit 1680b33

File tree

6 files changed

+63
-73
lines changed

6 files changed

+63
-73
lines changed

.github/workflows/create-tag.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ on:
55
types: [closed]
66
branches:
77
- core
8-
8+
- core-beta
9+
- pro
10+
- pro-beta
911
jobs:
1012
create-tag:
1113
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'tag/v')

.github/workflows/playwright.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
name: Playwright
1+
name: "(Test): Playwright"
22

33
on:
44
pull_request:
55
types: [labeled, synchronize, opened, reopened]
66
push:
77
branches:
88
- 'core'
9+
- 'pro'
910
paths-ignore:
1011
- '**.md'
1112
- '**.txt'

.github/workflows/prepare-tag.yml

Lines changed: 15 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -16,70 +16,16 @@ on:
1616

1717
jobs:
1818
version:
19-
runs-on: ubuntu-latest
20-
outputs:
21-
tag: ${{ steps.version.outputs.version }}
22-
steps:
23-
- name: Checkout branch for release
24-
uses: actions/checkout@v4
25-
26-
- name: Get tag version from package.json
27-
id: version
28-
run: |
29-
INPUT_VERSION=${{ github.event.inputs.version }}
30-
if [ -z "$INPUT_VERSION" ]; then
31-
echo "::info:: No version input provided, defaulting to 'next'."
32-
INPUT_VERSION="next"
33-
fi
34-
35-
if [ $INPUT_VERSION = "next" ]; then
36-
CURR=$(jq -r .version package.json)
37-
BRANCH_NAME="${{ github.ref_name }}"
38-
39-
# Check if branch name contains "beta"
40-
if [[ $BRANCH_NAME == *"beta"* ]]; then
41-
# Handle beta version (e.g., 3.7.1-beta.1 -> 3.7.1-beta.2)
42-
if [[ $CURR =~ ^([0-9]+\.[0-9]+\.[0-9]+-beta\.)([0-9]+)$ ]]; then
43-
BASE="${BASH_REMATCH[1]}"
44-
BETA_NUM="${BASH_REMATCH[2]}"
45-
NEW_BETA_NUM=$((BETA_NUM+1))
46-
NEW_VERSION="${BASE}${NEW_BETA_NUM}"
47-
echo "::notice::Incrementing beta version: $CURR -> $NEW_VERSION"
48-
else
49-
echo "::error::Branch contains 'beta' but version format is invalid: $CURR"
50-
exit 1
51-
fi
52-
else
53-
# Handle regular version (e.g., 3.7.1 -> 3.7.2)
54-
MAJOR=$(echo $CURR | cut -d. -f1)
55-
MINOR=$(echo $CURR | cut -d. -f2)
56-
PATCH=$(echo $CURR | cut -d. -f3)
57-
NEW_PATCH=$((PATCH+1))
58-
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
59-
fi
60-
VERSION="$NEW_VERSION"
61-
else
62-
VERSION="${{ github.event.inputs.version }}"
63-
fi
64-
65-
if [ -z "$VERSION" ]; then
66-
echo "::error::Version is empty. Failing job."
67-
exit 1
68-
fi
69-
echo "version=$VERSION" >> $GITHUB_OUTPUT
19+
if: github.event.inputs.version == 'next'
20+
uses: codesnippetspro/.github/.github/workflows/next_version.yml@main
21+
with:
22+
file_path: package.json
23+
ref_name: ${{ github.ref_name }}
7024

7125
changelog:
26+
if: always()
7227
runs-on: ubuntu-latest
7328
needs: version
74-
strategy:
75-
matrix:
76-
include:
77-
- target-file: "CHANGELOG.md"
78-
template: "changelog"
79-
name: "github-changelog"
80-
- target-file: "src/readme.txt"
81-
template: "readme"
82-
name: "wordpress-readme"
8329
steps:
8430
- name: Validate repository access
8531
id: validate
@@ -118,22 +64,22 @@ jobs:
11864
run: |
11965
target_repo="${{ steps.validate.outputs.target_repo }}"
12066
workflow_file="${{ steps.validate.outputs.workflow_file }}"
67+
version="${{ needs.version.outputs.version || github.event.inputs.version }}"
12168
122-
echo "::notice::Dispatching workflow '$workflow_file' for ${{ matrix.name }}..."
123-
echo " Repository: $target_repo"
124-
echo " Version: ${{ needs.version.outputs.tag }}"
125-
echo " Template: ${{ matrix.template }}"
126-
echo " Target file: ${{ matrix.target-file }}"
127-
69+
echo "::notice::Dispatching workflow '$workflow_file' to generate changelog and readme entries..."
70+
echo " Calling repo: $target_repo"
71+
echo " Version: $version"
72+
echo " Changelog path: ${GITHUB_EVENT_INPUTS_CHANGELOG_PATH:-./CHANGELOG.md}"
73+
echo " Readme path: ${GITHUB_EVENT_INPUTS_README_PATH:-./src/readme.txt}"
74+
12875
# Dispatch the workflow with required parameters
12976
if ! gh workflow run "$workflow_file" \
13077
--repo "$target_repo" \
13178
--ref main \
13279
--field repo="${{ github.repository }}" \
13380
--field branch="${{ github.ref_name }}" \
134-
--field version="${{ needs.version.outputs.tag }}" \
135-
--field template="${{ matrix.template }}" \
136-
--field target-file="./${{ matrix.target-file }}"; then
81+
--field version="$version" \
82+
--field readme_path="./src/readme.txt" ; then
13783
echo "::error::Failed to dispatch workflow '$workflow_file' in $target_repo"
13884
exit 1
13985
fi

.github/workflows/sync.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "(Sync): Core to Beta and Pro"
2+
3+
on:
4+
push:
5+
branches:
6+
- core
7+
- pro
8+
9+
jobs:
10+
check-sync:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
should_sync: ${{ steps.check.outputs.should_sync }}
14+
steps:
15+
- name: Check if sync is required
16+
id: check
17+
run: |
18+
COMMIT_MSG="${{ github.event.head_commit.message }}"
19+
if [[ "$COMMIT_MSG" == *"(sync):"* ]]; then
20+
echo "should_sync=true" >> $GITHUB_OUTPUT
21+
echo "::notice::Commit message contains (sync): - triggering sync workflow"
22+
else
23+
echo "should_sync=false" >> $GITHUB_OUTPUT
24+
echo "::notice::Commit message does not contain (sync): - skipping sync"
25+
fi
26+
27+
sync:
28+
needs: check-sync
29+
if: needs.check-sync.outputs.should_sync == 'true'
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Trigger downstream workflow via gh
33+
env:
34+
GH_TOKEN: ${{ secrets.CHANGELOG_PAT }}
35+
run: |
36+
gh workflow run sync-code-snippets.yml \
37+
--repo codesnippetspro/.github-private --ref main \
38+
--field caller_repo="${{ github.repository }}" \
39+
--field caller_ref="${{ github.ref_name }}" \
40+
--field commit_sha="${{ github.sha }}"
41+
echo "::notice::Dispatched sync workflow"

scripts/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const replaceInFile = (filename: string, transform: (contents: string) => string
1111
replaceInFile(
1212
'src/code-snippets.php',
1313
contents => contents
14-
.replace(/(?<prefix>Version:\s+|@version\s+)\d+\.\d+[\w-.]+$/mg, `$1${plugin.version}`)
14+
.replace(/(?<prefix>Version:\s+|@version\s+)\d+\.\d+\.\d+[\w-.]*$/mg, `$1${plugin.version}`)
1515
.replace(/(?<prefix>'CODE_SNIPPETS_VERSION',\s+)'[\w-.]+'/, `$1'${plugin.version}'`)
1616
)
1717

src/readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
=== Code Snippets ===
2-
Contributors: bungeshea, ver3, lightbulbman, 0aksmith, johnpixle
2+
Contributors: bungeshea, ver3, lightbulbman, 0aksmith, johnpixle, louiswol94, carolinaop
33
Donate link: https://codesnippets.pro
44
Tags: code, snippets, multisite, php, css
55
License: GPL-2.0-or-later

0 commit comments

Comments
 (0)