Skip to content

Commit

Permalink
Revert Bullseye to fix release issues
Browse files Browse the repository at this point in the history
It was incorrectly detecting AppVeyor as the host
  • Loading branch information
aaubry committed Dec 2, 2022
1 parent 78b1ab3 commit 2eecdb1
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 16 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/create-release.yml
Expand Up @@ -5,6 +5,9 @@ on:
ref:
description: Commit name to release (defaults to master)
required: false
args:
description: Additional command line arguments
required: false

jobs:
release:
Expand Down Expand Up @@ -41,4 +44,4 @@ jobs:
- name: Create draft release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./build.sh CreateGithubRelease
run: ./build.sh CreateGithubRelease ${{ github.event.inputs.args }}
23 changes: 17 additions & 6 deletions tools/build/BuildDefinition.cs
@@ -1,6 +1,7 @@
using Bullseye;
using SimpleExec;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
Expand Down Expand Up @@ -444,13 +445,23 @@ public static void Document(Options options)
");
}

private static string GitHubRepository =>
Program.Host switch
private static string GitHubRepository
{
get
{
Host.AppVeyor => Environment.GetEnvironmentVariable("APPVEYOR_REPO_NAME"),
_ => Environment.GetEnvironmentVariable("GITHUB_REPOSITORY")
var repository = Program.Host switch
{
Host.AppVeyor => Environment.GetEnvironmentVariable("APPVEYOR_REPO_NAME"),
_ => Environment.GetEnvironmentVariable("GITHUB_REPOSITORY")
};
if (repository == null)
{
WriteWarning($"Could not determine the current repository for host {Program.Host}. Falling-back to sandbox!");
repository = "aaubry/YamlDotNet.Sandbox";
}
return repository;
}
?? "aaubry/YamlDotNet.Sandbox";
}

private static readonly Lazy<HttpClient> GitHubClient = new Lazy<HttpClient>(() =>
{
Expand All @@ -463,7 +474,7 @@ Program.Host switch
gitHubClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/vnd.github.v3+json"));
gitHubClient.DefaultRequestHeaders.Add("User-Agent", GitHubRepository.Split('/')[0]);
gitHubClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("token", token);
gitHubClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
return gitHubClient;
});
Expand Down
19 changes: 11 additions & 8 deletions tools/build/Program.cs
@@ -1,4 +1,5 @@
using System;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand All @@ -9,6 +10,7 @@
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Bullseye;
using Bullseye.Internal;
using static Bullseye.Targets;

namespace build
Expand Down Expand Up @@ -134,7 +136,8 @@ static async Task<int> Main(string[] args)

var (specifiedTargets, options, unknownOptions, showHelp) = CommandLine.Parse(filteredArguments);
verbose = options.Verbose;
Host = options.Host.DetectIfNull();

Host = options.Host.DetectIfAutomatic();

var osPlatform =
RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
Expand Down Expand Up @@ -207,9 +210,9 @@ static async Task<int> Main(string[] args)
if (showHelp)
{
Console.WriteLine();
Console.WriteLine($"{palette.Text}Additional options:");
Console.WriteLine($" {palette.Option}--no-prerelease {palette.Text}Force the current version to be considered final{palette.Default}");
Console.WriteLine($" {palette.Option}--version=<version> {palette.Text}Force the current version to equal to the specified value{palette.Default}");
Console.WriteLine($"{palette.Default}Additional options:");
Console.WriteLine($" {palette.Option}--no-prerelease {palette.Default}Force the current version to be considered final{palette.Reset}");
Console.WriteLine($" {palette.Option}--version=<version> {palette.Default}Force the current version to equal to the specified value{palette.Reset}");
}

return exitCode;
Expand All @@ -225,12 +228,12 @@ public static void WriteVerbose(string text)

public static void WriteInformation(string text)
{
Console.WriteLine($" {palette.Text}(i) {text}{palette.Default}");
Console.WriteLine($" {palette.Default}(i) {text}{palette.Reset}");
}

public static void WriteWarning(string text)
{
Console.WriteLine($" {palette.Option}/!\\ {text}{palette.Default}");
Console.WriteLine($" {palette.Option}/!\\ {text}{palette.Reset}");
}

public static void WriteImportant(string text)
Expand Down Expand Up @@ -298,7 +301,7 @@ private static IEnumerable<string> WrapText(string text, int length)

private static void Write(string text, string color)
{
Console.WriteLine($"{color}{text}{palette.Default}");
Console.WriteLine($"{color}{text}{palette.Reset}");
}

public static IEnumerable<string> ReadLines(string name, string? args = null, string? workingDirectory = null) => SimpleExec.Command
Expand Down
2 changes: 1 addition & 1 deletion tools/build/build.csproj
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bullseye" Version="4.2.0" />
<PackageReference Include="Bullseye" Version="4.1.1" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
<PackageReference Include="SimpleExec" Version="6.4.0" />
</ItemGroup>
Expand Down

0 comments on commit 2eecdb1

Please sign in to comment.