Skip to content

Commit

Permalink
(build) small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
arturcic committed Aug 17, 2021
1 parent 6248e31 commit 08b777c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/homebrew.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: dawidd6/[email protected]
with:
# GitHub token, required, not the default one
token: ${{secrets.HOMEBREW_GITHUB_TOKEN}}
token: ${{secrets.RELEASE_GITHUB_TOKEN}}
# Formula name, required
formula: gitversion
tag: ${{ github.event.client_payload.ref }}
6 changes: 5 additions & 1 deletion build/publish/Tasks/PublishNuget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public override void Run(BuildContext context)
if (context.IsGitHubActionsBuild && context.IsOnMainBranchOriginalRepo)
{
var apiKey = context.Credentials?.GitHub?.Token;
if (string.IsNullOrEmpty(apiKey))
{
throw new InvalidOperationException("Could not resolve NuGet GitHub Packages API key.");
}
PublishToNugetRepo(context, apiKey, Constants.GithubPackagesUrl);
}
// publish to nuget.org for stable releases
Expand All @@ -51,7 +55,7 @@ public override void Run(BuildContext context)
PublishToNugetRepo(context, apiKey, Constants.NugetOrgUrl);
}
}
private static void PublishToNugetRepo(BuildContext context, string? apiKey, string? apiUrl)
private static void PublishToNugetRepo(BuildContext context, string apiKey, string apiUrl)
{
var nugetVersion = context.Version!.NugetVersion;
foreach (var (packageName, filePath, _) in context.Packages.Where(x => !x.IsChocoPackage))
Expand Down

0 comments on commit 08b777c

Please sign in to comment.