Instantly share code, notes, and snippets.

Embed
What would you like to do?
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