-
-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
22 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ public class UploadCommand : ICommand<UploadOptions> | |
|
||
public int Run(UploadOptions opts) | ||
{ | ||
string version = opts.Version ?? ProjectHelper.GetCurrentVersion(); | ||
string version = opts.Version ?? ProjectHelper.GetCurrentVersionName(); | ||
if (opts.Target != "sdk") | ||
{ | ||
// Validate all package files | ||
|
@@ -58,7 +58,7 @@ public int Run(UploadOptions opts) | |
if (opts.Target is "all" or "apt") | ||
{ | ||
Output.Info("Updating Apt metadata on downloads.naps2.com"); | ||
UpdateAptMetadata(); | ||
UpdateAptMetadata(version); | ||
didSomething = true; | ||
} | ||
if (opts.Target is "sdk") | ||
|
@@ -83,7 +83,8 @@ private async Task UploadToNuget() | |
var repository = Repository.Factory.GetCoreV3("https://api.nuget.org/v3/index.json"); | ||
var resource = await repository.GetResourceAsync<PackageUpdateResource>(); | ||
var v = ProjectHelper.GetSdkVersion(); | ||
var packagePaths = ProjectHelper.GetSdkProjects().Select(x => $"{GetProjectFolder(x)}/bin/Release/{x}.{v}.nupkg").ToList(); | ||
var packagePaths = ProjectHelper.GetSdkProjects() | ||
.Select(x => $"{GetProjectFolder(x)}/bin/Release/{x}.{v}.nupkg").ToList(); | ||
var key = await File.ReadAllTextAsync(Path.Combine(Paths.Naps2UserFolder, "nuget")); | ||
await resource.Push( | ||
packagePaths, | ||
|
@@ -179,6 +180,11 @@ private async Task UploadToSourceForge(string version) | |
client.UploadFile(stream, $"/home/frs/project/naps2/{version}/{Path.GetFileName(path)}"); | ||
} | ||
} | ||
if (version.Contains('b')) | ||
{ | ||
Output.Verbose("Skipping default downloads for beta"); | ||
return; | ||
} | ||
Output.Verbose($"Setting default downloads"); | ||
var httpClient = new HttpClient(); | ||
httpClient.DefaultRequestHeaders.Add("Accept", "application/json"); | ||
|
@@ -232,8 +238,14 @@ private void UploadToStaticSite(string version, string? packageType) | |
Output.Info($"Uploaded files."); | ||
} | ||
|
||
private void UpdateAptMetadata() | ||
private void UpdateAptMetadata(string version) | ||
{ | ||
if (version.Contains('b')) | ||
{ | ||
Output.Verbose("Skipping APT metadata for beta"); | ||
return; | ||
} | ||
|
||
var aptTemp = Path.Combine(Paths.SetupObj, "apt"); | ||
if (Directory.Exists(aptTemp)) | ||
{ | ||
|
@@ -243,9 +255,12 @@ private void UpdateAptMetadata() | |
|
||
Cli.Run("ssh", "[email protected] \"mkdir -p /home/user/apt-temp-packages/\""); | ||
Cli.Run("ssh", "[email protected] \"mkdir -p /home/user/apt-temp-release/\""); | ||
Cli.Run("ssh", "[email protected] \"cd /var/www/html/ ; apt-ftparchive packages . > /home/user/apt-temp-packages/Packages\" ; apt-ftparchive release /home/user/apt-temp-packages/ > /home/user/apt-temp-release/Release\""); | ||
Cli.Run("scp", $"[email protected]:/home/user/apt-temp-packages/Packages {Path.Combine(aptTemp, "Packages")}"); | ||
Cli.Run("scp", $"[email protected]:/home/user/apt-temp-release/Release {Path.Combine(aptTemp, "Release")}"); | ||
Cli.Run("ssh", | ||
"[email protected] \"cd /var/www/html/ ; apt-ftparchive packages . > /home/user/apt-temp-packages/Packages\" ; apt-ftparchive release /home/user/apt-temp-packages/ > /home/user/apt-temp-release/Release\""); | ||
Cli.Run("scp", | ||
$"[email protected]:/home/user/apt-temp-packages/Packages {Path.Combine(aptTemp, "Packages")}"); | ||
Cli.Run("scp", | ||
$"[email protected]:/home/user/apt-temp-release/Release {Path.Combine(aptTemp, "Release")}"); | ||
Cli.Run("gpg", $"--output {Path.Combine(aptTemp, "Release.gpg")} --sign {Path.Combine(aptTemp, "Release")}"); | ||
Cli.Run("gpg", $"--output {Path.Combine(aptTemp, "InRelease")} --clearsign {Path.Combine(aptTemp, "Release")}"); | ||
Cli.Run("scp", $"{Path.Combine(aptTemp, "Packages")} [email protected]:/var/www/html/Packages"); | ||
|