mirror of
https://github.com/boostorg/boost-tasks.git
synced 2026-01-19 04:02:13 +00:00
54 lines
1.4 KiB
PHP
Executable File
54 lines
1.4 KiB
PHP
Executable File
#!/usr/bin/env php
|
|
<?php
|
|
|
|
/*
|
|
* Copyright 2013 Daniel James <daniel@calamity.org.uk>.
|
|
*
|
|
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
*/
|
|
|
|
require_once(__DIR__.'/vendor/autoload.php');
|
|
|
|
use BoostTasks\Process;
|
|
use BoostTasks\Settings;
|
|
use BoostTasks\RepoBase;
|
|
use BoostTasks\Log;
|
|
// use RuntimeException;
|
|
|
|
Settings::init();
|
|
|
|
try {
|
|
$dst = Settings::dataPath().'/upload';
|
|
|
|
if (is_dir($dst)) {
|
|
Process::run("rm -r {$dst}");
|
|
}
|
|
|
|
mkdir($dst);
|
|
|
|
$repo = new RepoBase(__DIR__);
|
|
$hash = trim($repo->commandWithOutput("rev-parse HEAD"));
|
|
$repo->command("archive {$hash} | tar -x -C {$dst}");
|
|
file_put_contents("{$dst}/commit_hash.txt", $hash);
|
|
|
|
#Process::run("rm -r {$dst}/nbproject");
|
|
Process::run("rm {$dst}/upload-this-to-server");
|
|
Process::run("rsync --exclude var --exclude vendor -azv --delete-after {$dst}/ dnljms@boost.org:boost-tasks/");
|
|
|
|
// Record the upload.
|
|
$repo->command("fetch -p");
|
|
$tree_hash = trim($repo->commandWithOutput("rev-parse {$hash}^{tree}"));
|
|
$commit_hash = trim($repo->commandWithOutput("commit-tree -m Upload -p origin/upload -p {$hash} {$tree_hash}"));
|
|
$repo->command("push origin {$commit_hash}:upload");
|
|
}
|
|
catch (RuntimeException $e) {
|
|
Log::error("Runtime exception: {$e}");
|
|
exit(1);
|
|
}
|
|
|
|
// Return an error code if an error was logged.
|
|
if (Log::$error) {
|
|
exit(1);
|
|
}
|