Skip to content

Commit b3b71b9

Browse files
authored
[Fix]Release pipeline compliance (#556)
* Configure NuGet package sources for CI builds
1 parent ca1959f commit b3b71b9

4 files changed

Lines changed: 38 additions & 4 deletions

File tree

.github/workflows/build.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,21 @@ jobs:
128128
if (-not [string]::IsNullOrWhiteSpace("${{ secrets.LAF_PUBLISHER_ID }}")) {
129129
echo "LAF_PUBLISHER_ID=${{ secrets.LAF_PUBLISHER_ID }}" >> $env:GITHUB_ENV
130130
}
131+
- name: Create ephemeral nuget config from template
132+
shell: pwsh
133+
run: |
134+
$templatePath = "${{ github.workspace }}\nuget.config.template"
135+
$configPath = "$env:RUNNER_TEMP\nuget.config"
136+
137+
if (-not (Test-Path $templatePath)) {
138+
Write-Error "Template file not found: $templatePath"
139+
exit 1
140+
}
141+
142+
Copy-Item -Path $templatePath -Destination $configPath -Force
143+
echo "EPHEMERAL_NUGET_CONFIG=$configPath" >> $env:GITHUB_ENV
131144
- name: Restore dependencies
132-
run: dotnet restore AIDevGallery.sln -r win-${{ matrix.dotnet-arch }} /p:Configuration=${{ matrix.dotnet-configuration }} /p:Platform=${{ matrix.dotnet-arch }} /p:PublishReadyToRun=true /p:SelfContainedIfPreviewWASDK=true
145+
run: dotnet restore AIDevGallery.sln -r win-${{ matrix.dotnet-arch }} /p:Configuration=${{ matrix.dotnet-configuration }} /p:Platform=${{ matrix.dotnet-arch }} /p:PublishReadyToRun=true /p:SelfContainedIfPreviewWASDK=true --configfile "${{ env.EPHEMERAL_NUGET_CONFIG }}"
133146
- name: Build
134147
run: |
135148
dotnet build AIDevGallery.Utils --no-restore /p:Configuration=${{ matrix.dotnet-configuration }} /p:LafToken="${{ env.LAF_TOKEN }}" /p:LafPublisherId="${{ env.LAF_PUBLISHER_ID }}"

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,4 +398,7 @@ FodyWeavers.xsd
398398
*.sln.iml
399399

400400
# macOS
401-
.DS_Store
401+
.DS_Store
402+
403+
# Local NuGet config (for development, to avoid SSCA compliance issues in ADO)
404+
nuget.config

Directory.Build.targets

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,22 @@
22
<ItemGroup>
33
<PackageReference Include="StyleCop.Analyzers" PrivateAssets="All" />
44
</ItemGroup>
5+
6+
<!-- Auto-create nuget.config from template for local development -->
7+
<Target Name="EnsureNuGetConfig" BeforeTargets="CollectPackageReferences;Restore">
8+
<PropertyGroup>
9+
<NuGetConfigTemplate>$(MSBuildThisFileDirectory)nuget.config.template</NuGetConfigTemplate>
10+
<NuGetConfigTarget>$(MSBuildThisFileDirectory)nuget.config</NuGetConfigTarget>
11+
</PropertyGroup>
12+
<Message Text="Checking for nuget.config..." Importance="low" />
13+
<Copy SourceFiles="$(NuGetConfigTemplate)"
14+
DestinationFiles="$(NuGetConfigTarget)"
15+
Condition="Exists('$(NuGetConfigTemplate)') And !Exists('$(NuGetConfigTarget)')"
16+
SkipUnchangedFiles="true">
17+
<Output TaskParameter="CopiedFiles" ItemName="NuGetConfigCreated" />
18+
</Copy>
19+
<Message Text="Created nuget.config from template for local development"
20+
Importance="high"
21+
Condition="'@(NuGetConfigCreated)' != ''" />
22+
</Target>
523
</Project>

nuget.config renamed to nuget.config.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<packageSources>
44
<clear />
@@ -13,4 +13,4 @@
1313
<package pattern="*Foundry*" />
1414
</packageSource>
1515
</packageSourceMapping>
16-
</configuration>
16+
</configuration>

0 commit comments

Comments
 (0)