Create a customized myers diff based system for snip content
This commit is contained in:
27
deploy/git.php
Normal file
27
deploy/git.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Deployer;
|
||||
|
||||
desc('Transfers information about current git commit to server');
|
||||
task('deployment:log', function () { //https://stackoverflow.com/questions/59686270/how-to-log-deployments-in-deployer
|
||||
$branch = parse('{{branch}}');
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$commitHashShort = runLocally('git rev-parse --short HEAD');
|
||||
// $commitHash = runLocally('git rev-parse HEAD');
|
||||
$commit = explode(PHP_EOL, runLocally('git log -1 --pretty="%H%n%ci"'));
|
||||
$commitHash = $commit[0];
|
||||
$commitDate = $commit[1];
|
||||
|
||||
// $line = sprintf('%s %s branch="%s" hash="%s"', $date, $commitHashShort, $branch, $commitHash);
|
||||
$array = [
|
||||
'branch' => $branch,
|
||||
'date' => $date,
|
||||
'commitHashShort' => $commitHashShort,
|
||||
'commitHashLong' => $commitHash,
|
||||
'commitDate' => $commitDate,
|
||||
];
|
||||
$json = json_encode($array, JSON_PRETTY_PRINT);
|
||||
|
||||
runLocally("echo '$json' > release.json");
|
||||
upload('release.json', '{{release_path}}/release.json');
|
||||
});
|
Reference in New Issue
Block a user