Skip to content

Commit 6a4d00c

Browse files
authored
Merge branch 'trunk' into update/make-useBlockEditingMode-public
2 parents 5b1e455 + bf8023a commit 6a4d00c

File tree

385 files changed

+3900
-1667
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

385 files changed

+3900
-1667
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@
5454
# Full Site Editing
5555
/packages/edit-site
5656

57+
# Interactivity API
58+
/packages/interactivity @luisherranz @darerodz
59+
5760
# Tooling
5861
/bin @ntwb @nerrad @ajitbohra
5962
/bin/api-docs @ntwb @nerrad @ajitbohra

.github/workflows/build-plugin-zip.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
github.event.inputs.version == 'rc' ||
5757
github.event.inputs.version == 'stable'
5858
) || (
59-
endsWith( github.ref, needs.compute-stable-branches.outputs.current_stable_branch ) &&
59+
startsWith( github.ref, 'refs/heads/release/' ) &&
6060
github.event.inputs.version == 'stable'
6161
)
6262
)

.github/workflows/unit-test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ jobs:
8585
fail-fast: true
8686
matrix:
8787
php:
88-
- '5.6'
8988
- '7.0'
9089
- '7.1'
9190
- '7.2'

.github/workflows/upload-release-to-plugin-repo.yml

Lines changed: 107 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,66 @@ on:
55
types: [published]
66

77
jobs:
8+
compute-should-update-trunk:
9+
name: Decide if trunk or tag
10+
runs-on: ubuntu-latest
11+
# Skip this job if the release is a release candidate. This will in turn skip
12+
# the upload jobs, which are only relevant for non-RC releases.
13+
# We first check if the release is a prerelease, and then if the ref contains
14+
# the string "rc". The latter is fallback in case the deployer accidentally
15+
# unchecks the "This is a pre-release" checkbox in the release UI.
16+
if: |
17+
!github.event.release.prerelease && !contains(github.ref, 'rc')
18+
19+
outputs:
20+
should_update_trunk: ${{ steps.compute_should_update_trunk.outputs.should_update_trunk }}
21+
22+
steps:
23+
- name: Fetch latest version in the WP core repo
24+
id: compute_latest_version_in_core_repo
25+
run: |
26+
latest_version_in_core_repo=$(curl -s 'https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request\[slug\]=gutenberg' | jq -r '.version')
27+
echo "Latest Core Repo version: $latest_version_in_core_repo"
28+
echo "version=$latest_version_in_core_repo" >> $GITHUB_OUTPUT
29+
30+
- name: Decide if it is a trunk or tag update
31+
id: compute_should_update_trunk
32+
env:
33+
GITHUB_REF: ${{ github.ref }}
34+
run: |
35+
latestPublishedVersion=$(echo "$GITHUB_REF" | sed -E 's/refs\/tags\/(v?)([0-9.]+)/\2/')
36+
latestVersionInCoreRepo="${{ steps.compute_latest_version_in_core_repo.outputs.version }}"
37+
38+
# Determines if the first version string is greater than the second version string.
39+
#
40+
# Params:
41+
# $1 - The first version string to compare, which may have an optional leading "v".
42+
# $2 - The second version string to compare, which may have an optional leading "v".
43+
#
44+
# Return values:
45+
# 0 - The first version string is greater than the second version string.
46+
# 1 - The first version string is less than or equal to the second version string.
47+
is_first_version_greater_than_second() {
48+
v1=${1#v}
49+
v2=${2#v}
50+
dpkg --compare-versions "$v1" gt "$v2"
51+
return $?
52+
}
53+
54+
# Only update trunk *if* the published release's version in Github is GREATER
55+
# than the version currently published in the WP plugins repo. If not, then it
56+
# will upload it as a new tag.
57+
shouldUpdateTrunk=false
58+
if is_first_version_greater_than_second "$latestPublishedVersion" "$latestVersionInCoreRepo"; then
59+
shouldUpdateTrunk=true
60+
fi
61+
62+
echo "Should update trunk: $shouldUpdateTrunk"
63+
echo "should_update_trunk=$shouldUpdateTrunk" >> $GITHUB_OUTPUT
64+
865
get-release-branch:
966
name: Get release branch name
1067
runs-on: ubuntu-latest
11-
if: github.event.release.assets[0]
1268
outputs:
1369
release_branch: ${{ steps.get_release_branch.outputs.release_branch }}
1470

@@ -25,7 +81,8 @@ jobs:
2581
update-changelog:
2682
name: Update Changelog on ${{ matrix.branch }} branch
2783
runs-on: ubuntu-latest
28-
if: github.event.release.assets[0]
84+
if: |
85+
github.event.release.assets[0]
2986
needs: get-release-branch
3087
env:
3188
TAG: ${{ github.event.release.tag_name }}
@@ -95,11 +152,12 @@ jobs:
95152
path: ./changelog.txt
96153

97154
upload:
98-
name: Upload Gutenberg Plugin
155+
name: Publish as trunk (and tag)
99156
runs-on: ubuntu-latest
100157
environment: wp.org plugin
101-
needs: update-changelog
102-
if: ${{ !github.event.release.prerelease && github.event.release.assets[0] }}
158+
needs: [compute-should-update-trunk, update-changelog]
159+
if: |
160+
needs.compute-should-update-trunk.outputs.should_update_trunk == 'true' && github.event.release.assets[0]
103161
env:
104162
PLUGIN_REPO_URL: 'https://plugins.svn.wordpress.org/gutenberg'
105163
STABLE_VERSION_REGEX: '[0-9]\+\.[0-9]\+\.[0-9]\+\s*'
@@ -109,11 +167,7 @@ jobs:
109167

110168
steps:
111169
- name: Check out Gutenberg trunk from WP.org plugin repo
112-
run: svn checkout "$PLUGIN_REPO_URL/trunk"
113-
114-
- name: Get previous stable version
115-
id: get_previous_stable_version
116-
run: echo "stable_version=$(awk -F ':\ ' '$1 == "Stable tag" {print $2}' ./trunk/readme.txt)" >> $GITHUB_OUTPUT
170+
run: svn checkout "$PLUGIN_REPO_URL/trunk" --username "$SVN_USERNAME" --password "$SVN_PASSWORD"
117171

118172
- name: Delete everything
119173
working-directory: ./trunk
@@ -130,8 +184,8 @@ jobs:
130184
- name: Replace the stable tag placeholder with the existing stable tag on the SVN repository
131185
env:
132186
STABLE_TAG_PLACEHOLDER: 'Stable tag: V\.V\.V'
133-
STABLE_TAG: 'Stable tag: ${{ steps.get_previous_stable_version.outputs.stable_version }}'
134-
run: sed -i "s/${STABLE_TAG_PLACEHOLDER}/${STABLE_TAG}/g" ./trunk/readme.txt
187+
run: |
188+
sed -i "s/$STABLE_TAG_PLACEHOLDER/Stable tag: $VERSION/g" ./trunk/readme.txt
135189
136190
- name: Download Changelog Artifact
137191
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1
@@ -159,3 +213,44 @@ jobs:
159213
sed -i "s/Stable tag: ${STABLE_VERSION_REGEX}/Stable tag: ${VERSION}/g" ./readme.txt
160214
svn commit -m "Releasing version $VERSION" \
161215
--no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD"
216+
217+
upload-tag:
218+
name: Publish as tag
219+
runs-on: ubuntu-latest
220+
environment: wp.org plugin
221+
needs: [compute-should-update-trunk, update-changelog]
222+
if: |
223+
needs.compute-should-update-trunk.outputs.should_update_trunk == 'false' && github.event.release.assets[0]
224+
env:
225+
PLUGIN_REPO_URL: 'https://plugins.svn.wordpress.org/gutenberg'
226+
STABLE_VERSION_REGEX: '[0-9]\+\.[0-9]\+\.[0-9]\+\s*'
227+
SVN_USERNAME: ${{ secrets.svn_username }}
228+
SVN_PASSWORD: ${{ secrets.svn_password }}
229+
VERSION: ${{ github.event.release.name }}
230+
231+
steps:
232+
- name: Download and unzip Gutenberg plugin asset into tags folder
233+
env:
234+
PLUGIN_URL: ${{ github.event.release.assets[0].browser_download_url }}
235+
run: |
236+
# do the magic here
237+
curl -L -o gutenberg.zip $PLUGIN_URL
238+
unzip gutenberg.zip -d "$VERSION"
239+
rm gutenberg.zip
240+
241+
- name: Replace the stable tag placeholder with the existing stable tag on the SVN repository
242+
env:
243+
STABLE_TAG_PLACEHOLDER: 'Stable tag: V\.V\.V'
244+
run: |
245+
sed -i "s/$STABLE_TAG_PLACEHOLDER/Stable tag: $VERSION/g" "$VERSION/readme.txt"
246+
247+
- name: Download Changelog Artifact
248+
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1
249+
with:
250+
name: changelog trunk
251+
path: ${{ github.event.release.name }}
252+
253+
- name: Add the new version directory and commit changes to the SVN repository
254+
run: |
255+
svn import "$VERSION" "$PLUGIN_REPO_URL/tags/$VERSION" -m "Committing version $VERSION" \
256+
--no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD"

0 commit comments

Comments
 (0)