Skip to content

Commit ccca5c8

Browse files
committed
dev: fix requirement for auth to GitHub package source
1 parent 106104f commit ccca5c8

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

.github/workflows/publish_ci.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
env:
99
CONFIGURATION: Release
10+
1011
jobs:
1112
build:
1213
# Sets permissions of the GITHUB_TOKEN to allow release creating
@@ -15,14 +16,40 @@ jobs:
1516
environment:
1617
name: nuget
1718
runs-on: ubuntu-latest
19+
1820
steps:
1921
- uses: actions/checkout@v3
22+
2023
- name: Setup necessary dotnet SDKs
2124
uses: actions/setup-dotnet@v3
2225
with:
2326
global-json-file: global.json
2427
dotnet-version: |
2528
8.x
29+
30+
- name: Add the GitHub source
31+
run: dotnet nuget add source --name "github.com" "https://nuget.pkg.github.com/fsprojects/index.json"
32+
33+
- name: Ensure NuGet package source mapping
34+
shell: pwsh
35+
run: |
36+
$nugetConfigPath = "$HOME/.nuget/NuGet/NuGet.Config"
37+
[xml]$nugetConfig = Get-Content $nugetConfigPath
38+
if ($nugetConfig.configuration.packageSourceMapping -ne $null) {
39+
$nugetConfig.configuration.packageSourceMapping.RemoveAll()
40+
} else {
41+
$packageSourceMapping = $nugetConfig.CreateElement("packageSourceMapping")
42+
$nugetConfig.configuration.AppendChild($packageSourceMapping)
43+
}
44+
$packageSourceMapping = $nugetConfig.configuration.packageSourceMapping
45+
$nugetSource = $nugetConfig.CreateElement("packageSource")
46+
$nugetSource.SetAttribute("key", "nuget.org")
47+
$nugetPattern = $nugetConfig.CreateElement("package")
48+
$nugetPattern.SetAttribute("pattern", "*")
49+
$nugetSource.AppendChild($nugetPattern)
50+
$packageSourceMapping.AppendChild($nugetSource)
51+
$nugetConfig.Save($nugetConfigPath)
52+
2653
- name: Publish to GitHub
2754
env:
2855
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}

NuGet.config

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)