Skip to content

Instantly share code, notes, and snippets.

@danielbachhuber
Last active February 14, 2023 11:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielbachhuber/f5fc9caa03541698949af81e42130ad1 to your computer and use it in GitHub Desktop.
Save danielbachhuber/f5fc9caa03541698949af81e42130ad1 to your computer and use it in GitHub Desktop.
Create a build of the Gutenberg master branch
set -ex
# Expects git clone git@github.com:WordPress/gutenberg.git ~/gutenberg
cd ~/gutenberg
# Reset working directory
git checkout -f master
git pull origin master
# Run the initial gutenberg ZIP build
yes | npm run package-plugin
# Modify 'Version: ' to bump to next version and append short hash (e.g. '4.0-alpha-610aa4e')
echo '<?php file_put_contents( "gutenberg.php", preg_replace_callback( "#Version: (.+)#", function( $matches ) { $new_version = (float) $matches[1] + .1; $new_version .= ".0-alpha-" . substr( shell_exec( "git rev-parse HEAD" ), 0, 7 ); return str_replace( $matches[1], $new_version, $matches[0] ); }, file_get_contents( "gutenberg.php" ) ) );' | php
zip gutenberg.zip gutenberg.php
# Move ZIP file to builds directory
mv gutenberg.zip ~/webapps/builds/gutenberg-nightly-temp.zip
cd ~/webapps/builds/
# Rebuild the ZIP file to place all files within a base 'gutenberg/' directory
unzip gutenberg-nightly-temp.zip -d gutenberg
zip -r gutenberg-nightly-new.zip gutenberg
rm gutenberg-nightly-temp.zip
rm -r gutenberg
mv gutenberg-nightly-new.zip gutenberg-nightly.zip
date -u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment