Skip to content

Commit

Permalink
Execute PHAR after building
Browse files Browse the repository at this point in the history
Closes #26
  • Loading branch information
aik099 committed Dec 18, 2024
1 parent 248b408 commit 01487d8
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/SvnBuddyUpdater/ReleaseManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Aws\S3\S3Client;
use ConsoleHelpers\ConsoleKit\ConsoleIO;
use ConsoleHelpers\ConsoleKit\Exception\CommandException;
use Github\Client;
use Github\HttpClient\CachedHttpClient;
use Symfony\Component\Process\ProcessBuilder;
Expand Down Expand Up @@ -312,12 +313,38 @@ private function _createPhar($commit_hash, $stability)
$phar_file = $this->_snapshotsPath . '/svn-buddy.phar';
$signature_file = $this->_snapshotsPath . '/svn-buddy.phar.sig';

$this->_executePhar($phar_file);

return $this->_uploadToS3(
$stability . 's/' . $commit_hash,
array($phar_file, $signature_file)
);
}

/**
* Executes a PHAR file.
*
* @param string $phar_file Path to a PHAR file.
*
* @return void
* @throws CommandException When PHAR execution ended with an error.
*/
private function _executePhar($phar_file)
{
$this->_io->writeln(' * executing phar file ... ');

$exit_code = 0;
$output = array();
exec('php ' . escapeshellarg($phar_file), $output, $exit_code);

$this->_io->writeln(array('Exit Code: ' . $exit_code, 'Output:'));
$this->_io->writeln($output);

if ( $exit_code !== 0 ) {
throw new CommandException('Failed to execute "' . $phar_file . '" phar file.');
}
}

/**
* Deletes old releases.
*
Expand Down

0 comments on commit 01487d8

Please sign in to comment.