From e3c829d345575b41e321a91536e1429a03d31cb0 Mon Sep 17 00:00:00 2001 From: Nick Craver Date: Tue, 30 Sep 2025 11:05:57 -0400 Subject: [PATCH 1/2] Actions: support publishing to MyGet off main branch This is on the way to removing AppVeyor (currently broken) from our environment. Publishes to MyGet when building from a push to main, _not_ on pull requests. --- .github/workflows/CI.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1796710a7..900d35512 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -143,3 +143,8 @@ jobs: name: Tests Results - Windows Server 2022 path: 'test-results/*.trx' reporter: dotnet-trx + - name: .NET Pack + run: dotnet pack Build.csproj --no-build -c Release /p:PackageOutputPath=${env:GITHUB_WORKSPACE}\.nupkgs /p:CI=true + - name: Upload to MyGet + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + run: dotnet nuget push ${env:GITHUB_WORKSPACE}\.nupkgs\*.nupkg -s https://www.myget.org/F/stackoverflow/api/v2/package -k ${{ secrets.MYGET_API_KEY }} \ No newline at end of file From 8c90db5011cb612db6161a18736e773fe18e074b Mon Sep 17 00:00:00 2001 From: Nick Craver Date: Tue, 30 Sep 2025 11:07:19 -0400 Subject: [PATCH 2/2] Only package on main as well --- .github/workflows/CI.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 900d35512..37a419cc9 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -143,7 +143,9 @@ jobs: name: Tests Results - Windows Server 2022 path: 'test-results/*.trx' reporter: dotnet-trx + # Package and upload to MyGet only on pushes to main, not on PRs - name: .NET Pack + if: github.event_name == 'push' && github.ref == 'refs/heads/main' run: dotnet pack Build.csproj --no-build -c Release /p:PackageOutputPath=${env:GITHUB_WORKSPACE}\.nupkgs /p:CI=true - name: Upload to MyGet if: github.event_name == 'push' && github.ref == 'refs/heads/main'