@@ -179,7 +179,7 @@ jobs:
179179 fi
180180
181181 build :
182- name : Build Release Artifact
182+ name : ${{ matrix.IS_WORDPRESS_CORE && ' Build assets for wordpress-develop' || 'Build Release Artifact' }}
183183 runs-on : ' ubuntu-24.04'
184184 permissions :
185185 contents : read
@@ -190,6 +190,15 @@ jobs:
190190 github.event_name == 'workflow_dispatch' ||
191191 github.repository == 'WordPress/gutenberg'
192192 )
193+ strategy :
194+ matrix :
195+ IS_GUTENBERG_PLUGIN : [true]
196+ IS_WORDPRESS_CORE : [false]
197+
198+ include :
199+ - IS_GUTENBERG_PLUGIN : false
200+ IS_WORDPRESS_CORE : true
201+
193202 outputs :
194203 job_status : ${{ job.status }}
195204
@@ -202,24 +211,30 @@ jobs:
202211 persist-credentials : false
203212
204213 - name : Use desired version of Node.js
205- uses : actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2 .0
214+ uses : actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3 .0
206215 with :
207216 node-version-file : ' .nvmrc'
208217 check-latest : true
209218
219+ - name : Configure build for wordpress-develop
220+ if : ${{ matrix.IS_WORDPRESS_CORE }}
221+ run : jq --tab '.wpPlugin.name = "wp"' package.json > package.json.tmp && mv package.json.tmp package.json
222+
210223 - name : Build Gutenberg plugin ZIP file
211224 run : ./bin/build-plugin-zip.sh
212225 env :
213226 NO_CHECKS : ' true'
227+ IS_GUTENBERG_PLUGIN : ${{ matrix.IS_GUTENBERG_PLUGIN }}
228+ IS_WORDPRESS_CORE : ${{ matrix.IS_WORDPRESS_CORE }}
214229
215230 - name : Upload artifact
216231 uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
217232 with :
218- name : gutenberg-plugin
233+ name : gutenberg-${{ matrix.IS_WORDPRESS_CORE && 'wordpress-develop' || ' plugin' }}
219234 path : ./gutenberg.zip
220235
221236 - name : Build release notes draft
222- if : ${{ needs.bump-version.outputs.new_version }}
237+ if : ${{ matrix.IS_GUTENBERG_PLUGIN && needs.bump-version.outputs.new_version }}
223238 env :
224239 VERSION : ${{ needs.bump-version.outputs.new_version }}
225240 run : |
@@ -235,12 +250,65 @@ jobs:
235250 fi
236251
237252 - name : Upload release notes artifact
238- if : ${{ needs.bump-version.outputs.new_version }}
253+ if : ${{ matrix.IS_GUTENBERG_PLUGIN && needs.bump-version.outputs.new_version }}
239254 uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
240255 with :
241256 name : release-notes
242257 path : ./release-notes.txt
243258
259+ # Publishes the built plugin zip file to the GitHub Container registry.
260+ publish-to-container-registry :
261+ name : Publish to GitHub Container Registry
262+ runs-on : ' ubuntu-24.04'
263+ needs : ['bump-version', 'build']
264+ permissions :
265+ contents : read
266+ packages : write
267+ if : |
268+ always() &&
269+ needs.build.outputs.job_status == 'success' &&
270+ github.repository == 'WordPress/gutenberg' &&
271+ github.event_name == 'push'
272+
273+ steps :
274+ - name : Download build artifact
275+ uses : actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
276+ with :
277+ name : gutenberg-wordpress-develop
278+
279+ - name : Unzip zip artifact
280+ run : unzip gutenberg.zip && rm gutenberg.zip
281+
282+ # Noting the hash helps keep track of the commit the zip was built from.
283+ - name : Add a file for tracking the SHA value used.
284+ run : echo "${{ github.sha }}" > .gutenberg-hash
285+
286+ - name : Recompress as a .gz file
287+ run : tar -czf ${{ runner.temp }}/gutenberg.tar.gz . && mv ${{ runner.temp }}/gutenberg.tar.gz .
288+
289+ - name : Login to GitHub Container Registry
290+ uses : docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
291+ with :
292+ registry : ghcr.io
293+ username : ${{ github.actor }}
294+ password : ${{ secrets.GITHUB_TOKEN }}
295+
296+ # OCI Registry As Storage (ORAS) provides a way to push and pull non-image, generic artifacts (.gz files,
297+ # for example) to container registries such as GitHub Container Registry.
298+ - name : Setup ORAS
299+ uses : oras-project/setup-oras@22ce207df3b08e061f537244349aac6ae1d214f6 # v1.2.4
300+
301+ # The owner/repository is hard-coded because capital letters are not allowed when publishing to GitHub
302+ # Container Registry. The organization name is WordPress, so ${{ github.repository }} causes an error.
303+ # See https://github.com/orgs/community/discussions/27086 for more info.
304+ - name : Push built plugin .tar.gz file to GitHub Container Registry
305+ run : |
306+ oras push "ghcr.io/wordpress/gutenberg/gutenberg-wp-develop-build:${{ github.sha }}" \
307+ "gutenberg.tar.gz:application/gzip" \
308+ --annotation "org.opencontainers.image.description=Gutenberg plugin build for commit ${{ github.sha }}" \
309+ --annotation "org.opencontainers.image.source=https://github.com/${{ github.repository }}" \
310+ --annotation "org.opencontainers.image.revision=${{ github.sha }}"
311+
244312 revert-version-bump :
245313 name : Revert version bump if build failed
246314 needs : [bump-version, build]
@@ -379,7 +447,7 @@ jobs:
379447 git config user.email [email protected] 380448
381449 - name : Setup Node.js
382- uses : actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2 .0
450+ uses : actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3 .0
383451 with :
384452 node-version-file : ' main/.nvmrc'
385453 registry-url : ' https://registry.npmjs.org'
0 commit comments