version update for testing.
This commit is contained in:
parent
ebad42cf99
commit
feaff75121
|
@ -38,3 +38,4 @@ build/
|
||||||
src/main/resources/app
|
src/main/resources/app
|
||||||
/build_system
|
/build_system
|
||||||
/log
|
/log
|
||||||
|
/github_token.properties
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
dependency "dsh" version="~>1.6.1"
|
dependency "dsh" version="~>1.6.1"
|
||||||
dependency "dxml" version="~>0.4.3"
|
dependency "dxml" version="~>0.4.3"
|
||||||
dependency "requests" version="~>2.0.8"
|
dependency "requests" version="~>2.0.8"
|
||||||
|
dependency "d-properties" version="~>1.0.4"
|
||||||
+/
|
+/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,15 +52,9 @@ int main(string[] args) {
|
||||||
buildApp();
|
buildApp();
|
||||||
buildApi(ver);
|
buildApi(ver);
|
||||||
if (args.length >= 3 && args[2].strip.toLower == "release") {
|
if (args.length >= 3 && args[2].strip.toLower == "release") {
|
||||||
if (args.length >= 4) {
|
print("Are you sure you want to create a GitHub release for version %s?", ver);
|
||||||
string token = args[3].strip();
|
string response = readln().strip.toLower;
|
||||||
print("Are you sure you want to create a GitHub release for version %s?", ver);
|
if (response == "yes" || response == "y") createRelease(ver);
|
||||||
string response = readln().strip.toLower;
|
|
||||||
if (response == "yes" || response == "y") createRelease(token, ver);
|
|
||||||
} else {
|
|
||||||
error("Missing required personal access token to create a GitHub release.");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -114,6 +109,48 @@ string getVersion() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void createRelease(string token, string ver) {
|
void createRelease(string ver) {
|
||||||
|
import d_properties;
|
||||||
|
import requests;
|
||||||
|
import std.json;
|
||||||
|
|
||||||
|
print("Creating release...");
|
||||||
|
|
||||||
|
JSONValue data = [
|
||||||
|
"tag_name": "v" ~ ver,
|
||||||
|
"name": "Rail Signal v" ~ ver,
|
||||||
|
"body": "An automated release."
|
||||||
|
];
|
||||||
|
data.object["prerelease"] = JSONValue(true);
|
||||||
|
data.object["generate_release_notes"] = JSONValue(false);
|
||||||
|
print("Sending release API request:\n%s", data.toPrettyString);
|
||||||
|
|
||||||
|
auto rq = Request();
|
||||||
|
rq.verbosity = 2;
|
||||||
|
auto props = Properties("github_token.properties");
|
||||||
|
string username = props["username"];
|
||||||
|
string token = props["token"];
|
||||||
|
rq.authenticator = new BasicAuthentication(username, token);
|
||||||
|
auto response = rq.post(
|
||||||
|
"https://api.github.com/repos/andrewlalis/RailSignalAPI/releases",
|
||||||
|
data.toString,
|
||||||
|
"application/json"
|
||||||
|
);
|
||||||
|
if (response.code == 201) {
|
||||||
|
string responseBody = cast(string) response.responseBody;
|
||||||
|
JSONValue responseData = parseJSON(responseBody);
|
||||||
|
string assetUrl = responseData["assets_url"].str;
|
||||||
|
print("Got asset url: %s", assetUrl);
|
||||||
|
auto f = File("./target/rail-signal-" ~ ver ~ ".jar", "rb");
|
||||||
|
auto assetResponse = rq.post(
|
||||||
|
assetUrl,
|
||||||
|
f.byChunk(4096),
|
||||||
|
"application/zip"
|
||||||
|
);
|
||||||
|
writeln(assetResponse);
|
||||||
|
} else {
|
||||||
|
error("An error occurred.");
|
||||||
|
writeln(response.responseBody);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -10,7 +10,7 @@
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>nl.andrewl</groupId>
|
<groupId>nl.andrewl</groupId>
|
||||||
<artifactId>rail-signal-api</artifactId>
|
<artifactId>rail-signal-api</artifactId>
|
||||||
<version>2.2.0</version>
|
<version>2.2.1</version>
|
||||||
<name>rail-signal-api</name>
|
<name>rail-signal-api</name>
|
||||||
<description>A simple API for tracking rail traffic in signalled blocks.</description>
|
<description>A simple API for tracking rail traffic in signalled blocks.</description>
|
||||||
<properties>
|
<properties>
|
||||||
|
|
Loading…
Reference in New Issue