Release help
This commit is contained in:
parent
03f37eca62
commit
2d8f29caba
3 changed files with 64 additions and 7 deletions
|
@ -6,7 +6,7 @@
|
|||
* Time: 16:42
|
||||
*/
|
||||
|
||||
$BASE_PATH = "files/";
|
||||
$UI_BASE_PATH = "ui-files/";
|
||||
|
||||
if(!isset($_SERVER['REQUEST_METHOD'])) {
|
||||
error_log("This is a web only script!");
|
||||
|
@ -55,7 +55,7 @@
|
|||
}
|
||||
|
||||
function handle_develop_web_request() {
|
||||
global $BASE_PATH;
|
||||
global $UI_BASE_PATH;
|
||||
|
||||
if($_GET["type"] === "files") {
|
||||
header("Content-Type: text/plain");
|
||||
|
@ -63,7 +63,7 @@
|
|||
/* header("mode: develop"); */
|
||||
|
||||
echo ("type\thash\tpath\tname\n");
|
||||
foreach (list_dir($BASE_PATH) as $file) {
|
||||
foreach (list_dir($UI_BASE_PATH) as $file) {
|
||||
$type_idx = strrpos($file, ".");
|
||||
$type = substr($file, $type_idx + 1);
|
||||
if($type == "php") $type = "html";
|
||||
|
@ -75,13 +75,13 @@
|
|||
$name_idx = strrpos($name, ".");
|
||||
$name = substr($name, 0, $name_idx);
|
||||
|
||||
echo $type . "\t" . sha1_file($BASE_PATH . $file) . "\t" . $path . "\t" . $name . "." . $type . "\n";
|
||||
echo $type . "\t" . sha1_file($UI_BASE_PATH . $file) . "\t" . $path . "\t" . $name . "." . $type . "\n";
|
||||
}
|
||||
die;
|
||||
} else if($_GET["type"] === "file") {
|
||||
header("Content-Type: text/plain");
|
||||
|
||||
$path = realpath($BASE_PATH . $_GET["path"]);
|
||||
$path = realpath($UI_BASE_PATH . $_GET["path"]);
|
||||
$name = $_GET["name"];
|
||||
if($path === False || strpos($path, realpath(".")) === False || strpos($name, "/") !== False) die(json_encode([
|
||||
"success" => false,
|
||||
|
@ -102,6 +102,34 @@
|
|||
|
||||
fdump( $path . DIRECTORY_SEPARATOR . $name);
|
||||
die();
|
||||
} else if ($_GET["type"] == "update-info") {
|
||||
//TODO read real data from update/info.txt
|
||||
die(json_encode([
|
||||
"versions" => [
|
||||
[
|
||||
"channel" => "beta",
|
||||
"major" => 1,
|
||||
"minor" => 0,
|
||||
"patch" => 0,
|
||||
"build" => 0
|
||||
],
|
||||
[
|
||||
"channel" => "release",
|
||||
"major" => 1,
|
||||
"minor" => 0,
|
||||
"patch" => 0,
|
||||
"build" => 0
|
||||
]
|
||||
],
|
||||
"updater" => [
|
||||
"channel" => "release",
|
||||
"major" => 1,
|
||||
"minor" => 0,
|
||||
"patch" => 0,
|
||||
"build" => 0
|
||||
],
|
||||
"success" => true
|
||||
]));
|
||||
} else die(json_encode([
|
||||
"success" => false,
|
||||
"error" => "invalid action!"
|
||||
|
|
|
@ -250,7 +250,7 @@
|
|||
$environment = "web/dev-environment";
|
||||
} else if ($_SERVER["argv"][2] == "client") {
|
||||
$flagset = 0b10;
|
||||
$environment = "client-api/environment/files";
|
||||
$environment = "client-api/environment/ui-files";
|
||||
} else {
|
||||
error_log("Invalid type!");
|
||||
goto help;
|
||||
|
@ -262,7 +262,7 @@
|
|||
$environment = "web/rel-environment";
|
||||
} else if ($_SERVER["argv"][2] == "client") {
|
||||
$flagset = 0b10;
|
||||
$environment = "client-api/environment/files";
|
||||
$environment = "client-api/environment/ui-files";
|
||||
} else {
|
||||
error_log("Invalid type!");
|
||||
goto help;
|
||||
|
@ -313,6 +313,11 @@
|
|||
error_log("Failed to enter directory client-api/environment!");
|
||||
exit(1);
|
||||
}
|
||||
if(!is_dir("versions/beta"))
|
||||
exec($command = "mkdir -p versions/beta", $output, $state); if($state) goto handle_error;
|
||||
if(!is_dir("versions/stable"))
|
||||
exec($command = "mkdir -p versions/beta", $output, $state); if($state) goto handle_error;
|
||||
|
||||
exec($command = "ln -s ../api.php ./", $output, $state);
|
||||
if($state) goto handle_error;
|
||||
}
|
||||
|
|
24
scripts/git-release.sh
Normal file
24
scripts/git-release.sh
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
version=$1
|
||||
text=$2
|
||||
branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
repo_full_name=$(git config --get remote.origin.url | sed 's/.*:\/\/github.com\///;s/.git$//')
|
||||
token=$(git config --global github.token)
|
||||
|
||||
generate_post_data()
|
||||
{
|
||||
cat <<EOF
|
||||
{
|
||||
"tag_name": "$version",
|
||||
"target_commitish": "$branch",
|
||||
"name": "$version",
|
||||
"body": "$text",
|
||||
"draft": false,
|
||||
"prerelease": false
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
echo "Create release $version for repo: $repo_full_name branch: $branch"
|
||||
curl --data "$(generate_post_data)" "https://api.github.com/repos/$repo_full_name/releases?access_token=$token"
|
Loading…
Add table
Reference in a new issue