-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathundeploy
More file actions
executable file
·27 lines (18 loc) · 890 Bytes
/
undeploy
File metadata and controls
executable file
·27 lines (18 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env php
<?php
if(!defined('STDIN')) { die("You're unauthorized to view this page."); }
if(!file_exists('./script/wp-script-config.php')) { die("Your script/wp-script-config.php file wasn't found."); }
include_once('./script/wp-script-config.php');
if(!isset($argv[1])) { die("USAGE: ./script/undeploy [version-number]\n"); }
$my_version = $argv[1];
if(!preg_match('/\d+\.\d+\.\d+(([a-z_-]+)\d+)?/i', $my_version, $m)) {
exit("Improper Version Format\n\n");
}
echo "!! Un-Deploying version \"{$my_version}\"\n";
$commands = array(
"/usr/bin/git tag -d {$my_version}",
"/usr/bin/git push origin :refs/tags/{$my_version}",
'/usr/bin/curl -d "apikey=' . MOTHERSHIP_API_KEY . '" ' . MOTHERSHIP_URL . '/versions/undeploy/' . MOTHERSHIP_PROJECT_ID . '/' . $my_version,
);
foreach($commands as $command) { echo "\n$command\n"; system($command); sleep(1); }
echo "\n\n";