Add force mode to svn:publish command, add svn:checkout command
This commit is contained in:
@ -13,4 +13,6 @@ WP_TEST_MAILER_MAILPOET_API=""
|
||||
WP_TEST_MAILER_SENDGRID_API=""
|
||||
WP_TEST_MAILER_SMTP_HOST=""
|
||||
WP_TEST_MAILER_SMTP_LOGIN=""
|
||||
WP_TEST_MAILER_SMTP_PASSWORD=""
|
||||
WP_TEST_MAILER_SMTP_PASSWORD=""
|
||||
WP_SVN_USERNAME=""
|
||||
WP_SVN_PASSWORD=""
|
||||
|
@ -132,14 +132,16 @@ You can use Twig i18n functions in Handlebars, just load your template from a Tw
|
||||
# Publish
|
||||
|
||||
Before you run a publishing command, you need to:
|
||||
1. Set up a local copy of MailPoet SVN repository in `.mp_svn` directory. Sample command: `svn co https://plugins.svn.wordpress.org/mailpoet/ .mp_svn`. The repo should be up-to-date.
|
||||
1. Ensure there is an up-to-date local copy of MailPoet SVN repository in `.mp_svn` directory by running `./do svn:checkout`.
|
||||
2. Have all your features merged in Git `master`, your `mailpoet.php` and `readme.txt` tagged with a new version.
|
||||
3. Run `./build.sh` to produce a `mailpoet.zip` distributable archive.
|
||||
|
||||
Everything's ready? Then run `./do publish`.
|
||||
Everything's ready? Then run `./do svn:publish`.
|
||||
If the job goes fine, you'll get a message like this:
|
||||
```
|
||||
Go to '.mp_svn' and run 'svn ci -m "Release 3.0.0-beta.9"' to publish the
|
||||
release
|
||||
```
|
||||
It's quite literal: you can review the changes to be pushed and if you're satisfied, run the suggested command to finish the release publishing process.
|
||||
|
||||
If you're confident, execute `./do svn:publish --force` and your release will be published to the remote SVN repository without manual intervention (automatically). For easier authentication you might want to set `WP_SVN_USERNAME` and `WP_SVN_PASSWORD` environment variables.
|
||||
|
28
RoboFile.php
28
RoboFile.php
@ -199,7 +199,11 @@ class RoboFile extends \Robo\Tasks {
|
||||
);
|
||||
}
|
||||
|
||||
function publish() {
|
||||
function svnCheckout() {
|
||||
return $this->_exec('svn co https://plugins.svn.wordpress.org/mailpoet/ .mp_svn');
|
||||
}
|
||||
|
||||
function svnPublish($opts = ['force' => false]) {
|
||||
$this->loadWP();
|
||||
|
||||
$svn_dir = ".mp_svn";
|
||||
@ -270,10 +274,26 @@ class RoboFile extends \Robo\Tasks {
|
||||
$result = $collection->run();
|
||||
|
||||
if($result->wasSuccessful()) {
|
||||
// Run or suggest release command depending on a flag
|
||||
$release_cmd = "svn ci -m \"Release $plugin_version\"";
|
||||
$this->yell(
|
||||
"Go to '$svn_dir' and run '$release_cmd' to publish the release"
|
||||
);
|
||||
if(!empty($opts['force'])) {
|
||||
$svn_login = getenv('WP_SVN_USERNAME');
|
||||
$svn_password = getenv('WP_SVN_PASSWORD');
|
||||
if ($svn_login && $svn_password) {
|
||||
$release_cmd .= " --username $svn_login --password $svn_password";
|
||||
} else {
|
||||
$release_cmd .= ' --force-interactive';
|
||||
}
|
||||
$result = $this->taskExecStack()
|
||||
->stopOnFail()
|
||||
->dir($svn_dir)
|
||||
->exec($release_cmd)
|
||||
->run();
|
||||
} else {
|
||||
$this->yell(
|
||||
"Go to '$svn_dir' and run '$release_cmd' to publish the release"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
Reference in New Issue
Block a user