Remove version detection from svn:publish command
[MAILPOET-3828]
This commit is contained in:
26
RoboFile.php
26
RoboFile.php
@@ -548,16 +548,12 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
->run();
|
->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function svnPublish() {
|
public function svnPublish(string $version) {
|
||||||
$svnDir = ".mp_svn";
|
$svnDir = ".mp_svn";
|
||||||
$pluginVersion = $this->getPluginVersion('mailpoet.php');
|
|
||||||
$pluginDistName = 'mailpoet';
|
$pluginDistName = 'mailpoet';
|
||||||
$pluginDistFile = $pluginDistName . '.zip';
|
$pluginDistFile = $pluginDistName . '.zip';
|
||||||
|
|
||||||
if (!$pluginVersion) {
|
$this->say('Publishing version: ' . $version);
|
||||||
throw new \Exception('Could not parse plugin version, check the plugin header');
|
|
||||||
}
|
|
||||||
$this->say('Publishing version: ' . $pluginVersion);
|
|
||||||
|
|
||||||
// Sanity checks
|
// Sanity checks
|
||||||
if (!is_readable($pluginDistFile)) {
|
if (!is_readable($pluginDistFile)) {
|
||||||
@@ -566,8 +562,8 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
} elseif (!file_exists($svnDir . "/.svn/")) {
|
} elseif (!file_exists($svnDir . "/.svn/")) {
|
||||||
$this->say("$svnDir/.svn/ dir not found, is it a SVN repository?");
|
$this->say("$svnDir/.svn/ dir not found, is it a SVN repository?");
|
||||||
return;
|
return;
|
||||||
} elseif (file_exists($svnDir . "/tags/" . $pluginVersion)) {
|
} elseif (file_exists($svnDir . "/tags/" . $version)) {
|
||||||
$this->say("A SVN tag already exists: " . $pluginVersion);
|
$this->say("A SVN tag already exists: " . $version);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -631,8 +627,8 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
|
|
||||||
if ($result->wasSuccessful()) {
|
if ($result->wasSuccessful()) {
|
||||||
$repoUrl = "https://plugins.svn.wordpress.org/$pluginDistName";
|
$repoUrl = "https://plugins.svn.wordpress.org/$pluginDistName";
|
||||||
$releaseCmd = "svn ci -m \"Release $pluginVersion\"";
|
$releaseCmd = "svn ci -m \"Release $version\"";
|
||||||
$tagCmd = "svn copy $repoUrl/trunk $repoUrl/tags/$pluginVersion -m \"Tag $pluginVersion\"";
|
$tagCmd = "svn copy $repoUrl/trunk $repoUrl/tags/$version -m \"Tag $version\"";
|
||||||
$svnLogin = getenv('WP_SVN_USERNAME');
|
$svnLogin = getenv('WP_SVN_USERNAME');
|
||||||
$svnPassword = getenv('WP_SVN_PASSWORD');
|
$svnPassword = getenv('WP_SVN_PASSWORD');
|
||||||
if ($svnLogin && $svnPassword) {
|
if ($svnLogin && $svnPassword) {
|
||||||
@@ -770,8 +766,8 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
->addCode(function () {
|
->addCode(function () {
|
||||||
return $this->svnCheckout();
|
return $this->svnCheckout();
|
||||||
})
|
})
|
||||||
->addCode(function () {
|
->addCode(function () use ($version) {
|
||||||
return $this->svnPublish();
|
return $this->svnPublish($version);
|
||||||
})
|
})
|
||||||
->addCode(function () use ($version) {
|
->addCode(function () use ($version) {
|
||||||
return $this->releasePublishGithub($version);
|
return $this->releasePublishGithub($version);
|
||||||
@@ -950,12 +946,6 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getPluginVersion($file) {
|
|
||||||
$data = file_get_contents($file);
|
|
||||||
preg_match('/^[ \t*]*Version:(.*)$/mi', $data, $m);
|
|
||||||
return !empty($m[1]) ? trim($m[1]) : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function validateVersion($version) {
|
protected function validateVersion($version) {
|
||||||
if (!\MailPoetTasks\Release\VersionHelper::validateVersion($version)) {
|
if (!\MailPoetTasks\Release\VersionHelper::validateVersion($version)) {
|
||||||
$this->yell('Incorrect version format', 40, 'red');
|
$this->yell('Incorrect version format', 40, 'red');
|
||||||
|
Reference in New Issue
Block a user