Merge pull request #11 from woocommerce/add/release-script
Add release script
This commit is contained in:
commit
a1e14c0490
23
README.md
23
README.md
|
@ -104,3 +104,26 @@ const response = await apiFetch( {
|
|||
method: 'POST',
|
||||
} );
|
||||
```
|
||||
|
||||
### Deploying
|
||||
|
||||
Prerequisites:
|
||||
|
||||
- [Hub](https://github.com/github/hub)
|
||||
- Write access to this repository
|
||||
|
||||
You can create a test ZIP of the plugin using this command:
|
||||
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
This creates `woocommerce-admin-test-helper.zip` in the project root.
|
||||
|
||||
We release the plugin using GitHub Releases. There is a script to automate this:
|
||||
|
||||
0. Make sure the version is updated in `woocommerce-admin-test-helper.php`
|
||||
1. Commit and push to `trunk`
|
||||
2. Run `npm run release`
|
||||
3. Make sure you provide the correct version number when prompted
|
||||
4. That's it!
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
rm woocommerce-admin-test-helper.zip
|
||||
|
||||
echo "Building"
|
||||
npm run build
|
||||
|
||||
echo "Creating archive... 🎁"
|
||||
zip -r "woocommerce-admin-test-helper.zip" \
|
||||
woocommerce-admin-test-helper.php \
|
||||
plugin.php \
|
||||
build/ \
|
||||
api/ \
|
||||
README.md
|
|
@ -0,0 +1,61 @@
|
|||
#!/bin/sh
|
||||
|
||||
if ! [ -x "$(command -v hub)" ]; then
|
||||
echo 'Error: hub is not installed. Install from https://github.com/github/hub' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Releasing to GitHub"
|
||||
echo "==================="
|
||||
echo "Before proceeding:"
|
||||
echo " • Make sure you have updated the plugin version in woocommerce-admin-test-helper.php"
|
||||
echo " • Ensure you have checked out the branch you wish to release"
|
||||
echo " • Ensure you have committed/pushed all local changes"
|
||||
echo " • Did you remember to update changelogs, the readme and plugin files?"
|
||||
echo
|
||||
echo "Do you want to continue? [y/N]: "
|
||||
read -r PROCEED
|
||||
echo
|
||||
|
||||
if [ "$(echo "${PROCEED:-n}" | tr "[:upper:]" "[:lower:]")" != "y" ]; then
|
||||
echo "Release cancelled!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "What version do you want to release as? (make sure this matches the version in woocommerce-admin-test-helper.php)"
|
||||
read -r VERSION
|
||||
|
||||
CURRENTBRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
||||
|
||||
if [ ! -d "dist" ]; then
|
||||
echo "Dist directory not found. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Starting release to GitHub..."
|
||||
echo
|
||||
|
||||
# Create a release branch.
|
||||
BRANCH="build/${VERSION}"
|
||||
git checkout -b $BRANCH
|
||||
|
||||
# Force add build directory and commit.
|
||||
git add build/. --force
|
||||
git add .
|
||||
git commit -m "Adding /build directory to release" --no-verify
|
||||
|
||||
# Push branch upstream
|
||||
git push origin $BRANCH
|
||||
|
||||
# Create the zip archive
|
||||
./bin/build-zip.sh
|
||||
|
||||
# Create the new release.
|
||||
hub release create -m $VERSION -m "Release of version $VERSION." -t $BRANCH "v${VERSION}" --attach "./woocommerce-admin-test-helper.zip"
|
||||
|
||||
git checkout $CURRENTBRANCH
|
||||
git branch -D $BRANCH
|
||||
git push origin --delete $BRANCH
|
||||
|
||||
echo "GitHub release complete."
|
||||
|
|
@ -17,7 +17,9 @@
|
|||
"packages-update": "wp-scripts packages-update",
|
||||
"start": "wp-scripts start",
|
||||
"test:e2e": "wp-scripts test-e2e",
|
||||
"test:unit": "wp-scripts test-unit-js"
|
||||
"test:unit": "wp-scripts test-unit-js",
|
||||
"zip": "./bin/build-zip.sh",
|
||||
"release": "./bin/release-to-github.sh"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@woocommerce/dependency-extraction-webpack-plugin": "1.4.0",
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* Description: A helper plugin to assist with testing WooCommerce Admin
|
||||
* Author: WooCommerce
|
||||
* Author URI: https://woocommerce.com/
|
||||
* Version: 0.1.0-dev
|
||||
* Version: 0.1.0
|
||||
*
|
||||
* @package WooCommerce\Admin\TestHelper
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue