Updated distribution script with mono build

This commit is contained in:
unknown
2015-08-02 14:39:56 -06:00
parent 90f89542e2
commit eb66e5618f

View File

@@ -15,7 +15,8 @@ namespace Jackett.Distribution
{ {
static readonly string repoOwner = "zone117x"; static readonly string repoOwner = "zone117x";
static readonly string repoName = "Jackett"; static readonly string repoName = "Jackett";
static readonly string buildZipFile = "JackettBuild.zip"; static readonly string buildZipFileWindows = "JackettBuildWindows.zip";
static readonly string buildZipFileMono = "JackettBuildMono.zip";
static readonly string installFile = Path.Combine("Output", "setup.exe"); static readonly string installFile = Path.Combine("Output", "setup.exe");
static GitHubClient github; static GitHubClient github;
@@ -32,15 +33,18 @@ namespace Jackett.Distribution
github.Credentials = new Credentials(token); github.Credentials = new Credentials(token);
localVersion = GetJackettVersion(); localVersion = GetJackettVersion();
var latestReleaseVersion = LatestGithubRelease().Result; /*var latestReleaseVersion = LatestGithubRelease().Result;
if (localVersion <= latestReleaseVersion) if (localVersion <= latestReleaseVersion)
{ {
Console.WriteLine("Latest Github release is {0}, will not upload local version {1}", latestReleaseVersion, localVersion); Console.WriteLine("Latest Github release is {0}, will not upload local version {1}", latestReleaseVersion, localVersion);
return; return;
} }*/
Console.WriteLine("Zipping release build " + localVersion); Console.WriteLine("Zipping release build for Windows " + localVersion);
ZippingReleaseBuild(); ZippingReleaseBuildWindows();
Console.WriteLine("Zipping release build for Mono " + localVersion);
ZippingReleaseBuildMono();
UploadRelease().Wait(); UploadRelease().Wait();
} }
@@ -59,11 +63,18 @@ namespace Jackett.Distribution
return version; return version;
} }
static void ZippingReleaseBuild() static void ZippingReleaseBuildWindows()
{ {
if (File.Exists(buildZipFile)) if (File.Exists(buildZipFileWindows))
File.Delete(buildZipFile); File.Delete(buildZipFileWindows);
ZipFile.CreateFromDirectory("Build", buildZipFile); ZipFile.CreateFromDirectory("build.windows", buildZipFileWindows);
}
static void ZippingReleaseBuildMono()
{
if (File.Exists(buildZipFileMono))
File.Delete(buildZipFileMono);
ZipFile.CreateFromDirectory("build.mono", buildZipFileMono);
} }
static async Task UploadRelease() static async Task UploadRelease()
@@ -93,23 +104,23 @@ namespace Jackett.Distribution
var releaseResult = await github.Release.Create(repoOwner, repoName, newRelease); var releaseResult = await github.Release.Create(repoOwner, repoName, newRelease);
Console.WriteLine("Uploading Windows build");
await UploadFileToGithub(releaseResult, buildZipFileWindows, string.Format("Jackett.Windows.v{0}.zip", localVersion), "application/zip");
Console.WriteLine("Uploading Mono build");
await UploadFileToGithub(releaseResult, buildZipFileMono, string.Format("Jackett.Mono.v{0}.zip", localVersion), "application/zip");
Console.WriteLine("Uploading Windows installer");
await UploadFileToGithub(releaseResult, installFile, string.Format("Jackett.v{0}.Windows.Installer.exe", localVersion), "application/octet-stream");
}
var buildZipAsset = new ReleaseAssetUpload() static Task UploadFileToGithub(Release githubRelease, string filePath, string filePublishName, string contentType)
{
var buildZipAssetWindows = new ReleaseAssetUpload()
{ {
FileName = string.Format("Jackett.v{0}.zip", localVersion), FileName = filePublishName,
ContentType = "application/zip", ContentType = contentType,
RawData = File.OpenRead(buildZipFile) RawData = File.OpenRead(filePath)
}; };
var buildZipAssetResult = await github.Release.UploadAsset(releaseResult, buildZipAsset); return github.Release.UploadAsset(githubRelease, buildZipAssetWindows);
var installFileAsset = new ReleaseAssetUpload()
{
FileName = string.Format("Jackett.v{0}.Windows.Installer.exe", localVersion),
ContentType = "application/octet-stream",
RawData = File.OpenRead(installFile)
};
var installFileAssetResult = await github.Release.UploadAsset(releaseResult, installFileAsset);
} }
} }
} }