Skip to content

Commit

Permalink
dev: fix requirement for auth to GitHub package source
Browse files Browse the repository at this point in the history
  • Loading branch information
xperiandri committed Nov 20, 2024
1 parent 106104f commit 2b76320
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/publish_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

env:
CONFIGURATION: Release

jobs:
build:
# Sets permissions of the GITHUB_TOKEN to allow release creating
Expand All @@ -15,14 +16,38 @@ jobs:
environment:
name: nuget
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup necessary dotnet SDKs
uses: actions/setup-dotnet@v3
with:
global-json-file: global.json
dotnet-version: |
8.x
- name: Add the GitHub source
run: dotnet nuget add source --name "github.com" "https://nuget.pkg.github.com/fsprojects/index.json"

- name: Ensure NuGet package source mapping
run: |
$nugetConfigPath = "$HOME/.nuget/NuGet/NuGet.Config"
[xml]$nugetConfig = Get-Content $nugetConfigPath
if ($nugetConfig.configuration.packageSourceMapping -ne $null) {
$nugetConfig.configuration.packageSourceMapping.RemoveAll()
} else {
$packageSourceMapping = $nugetConfig.CreateElement("packageSourceMapping")
$nugetConfig.configuration.AppendChild($packageSourceMapping)
}
$nugetSource = $nugetConfig.CreateElement("packageSource")
$nugetSource.SetAttribute("key", "nuget.org")
$nugetPattern = $nugetConfig.CreateElement("package")
$nugetPattern.SetAttribute("pattern", "*")
$nugetSource.AppendChild($nugetPattern)
$nugetConfig.configuration.packageSourceMapping.AppendChild($nugetSource)
$nugetConfig.Save($nugetConfigPath)
- name: Publish to GitHub
env:
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
Expand Down
12 changes: 0 additions & 12 deletions NuGet.config

This file was deleted.

0 comments on commit 2b76320

Please sign in to comment.