diff --git a/deploy.php b/deploy.php index 619b4b8..b674824 100644 --- a/deploy.php +++ b/deploy.php @@ -286,10 +286,29 @@ task('absdev:laravel:prepare', function (): void { desc('Write Git revision metadata'); task('absdev:revision', function (): void { + $revision = get('release_revision'); + + if (empty($revision)) { + throw new \RuntimeException( + 'Deployer did not provide a Git revision.' + ); + } + run( - 'cd {{release_path}}' - . ' && git rev-parse HEAD > REVISION' - . ' && date -u +%Y-%m-%dT%H:%M:%SZ > DEPLOYED_AT' + 'printf %s\\n ' + . escapeshellarg($revision) + . ' > {{release_path}}/REVISION' + ); + + run( + 'date -u +%Y-%m-%dT%H:%M:%SZ' + . ' > {{release_path}}/DEPLOYED_AT' + ); + + writeln( + 'Release revision: ' + . $revision + . '' ); });