Skip to content

Commit e5ace1a

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

File tree

2 files changed

+30
-12
lines changed

2 files changed

+30
-12
lines changed

.github/workflows/publish_ci.yml

Lines changed: 30 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,43 @@ 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+
39+
$packageSourceMapping = $nugetConfig.configuration.packageSourceMapping
40+
if ($packageSourceMapping -ne $null) {
41+
$packageSourceMapping.RemoveAll()
42+
} else {
43+
$packageSourceMapping = $nugetConfig.CreateElement("packageSourceMapping")
44+
$nugetConfig.configuration.AppendChild($packageSourceMapping)
45+
}
46+
47+
$nugetSource = $nugetConfig.CreateElement("packageSource")
48+
$nugetSource.SetAttribute("key", "nuget.org")
49+
$nugetPattern = $nugetConfig.CreateElement("package")
50+
$nugetPattern.SetAttribute("pattern", "*")
51+
$nugetSource.AppendChild($nugetPattern)
52+
$packageSourceMapping.AppendChild($nugetSource)
53+
54+
$nugetConfig.Save($nugetConfigPath)
55+
2656
- name: Publish to GitHub
2757
env:
2858
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}

NuGet.config

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

0 commit comments

Comments
 (0)