From c092fb792a9ce3f4c9b23e33d03ecaa44b8d3015 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Mon, 1 Jul 2024 10:18:03 +0700 Subject: [PATCH 01/11] Add NuGet packaging step to CI/CD workflow For now this just uploads to build artifacts; we will upload to nuget.org once we've tested that the packages are built correctly. --- .github/workflows/ci-cd.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 64c285c1..ad6f1d9b 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -96,6 +96,17 @@ jobs: shell: cmd run: msbuild build\FLExBridge.proj /t:Test /p:Configuration=Release + - name: Create NuGet packages + shell: cmd + run: msbuild build\FLExBridge.proj /t:Pack /p:Configuration=Release + + - name: Upload NuGet packages to build artifacts + uses: actions/upload-artifact@v4 + with: + name: nuget-packages + path: output/*nupkg + if-no-files-found: warn + # All the following are used only when building an installer after a merge - name: Build Msi id: build_msi From 9311d7ae59cd3c7dc95ac435cf8d9af177e9a953 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Mon, 1 Jul 2024 13:48:10 +0700 Subject: [PATCH 02/11] Add commented-out step to publish NuGet packages Requires a GitHub secret named NUGET_APIKEY before it will work. Currently commented out so it won't break the build until that secret is uploaded to the GitHub repo. --- .github/workflows/ci-cd.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index ad6f1d9b..05f3a564 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -107,6 +107,14 @@ jobs: path: output/*nupkg if-no-files-found: warn + # --skip-duplicate allows retrying a workflow that failed with a partial push, skipping already published packages and publishing the rest. + # - name: Publish NuGet packages to nuget.org + # run: | + # foreach ($pkg in (Get-ChildItem output -Include *.nupkg)) { + # dotnet nuget push $pkg --skip-duplicate --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json + # } + # if: github.event_name != 'pull_request' + # All the following are used only when building an installer after a merge - name: Build Msi id: build_msi From f5d7fe15dbeac21c62e8991e9f26dbf8079657e5 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Tue, 2 Jul 2024 10:05:27 +0700 Subject: [PATCH 03/11] Simulate publishing NuGet packages on PRs Don't actually publish, but show the lines that would have run. This also tests whether we can use the "if" condition to skip running the step in the absence of an API key. --- .github/workflows/ci-cd.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 05f3a564..0f751508 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -108,13 +108,23 @@ jobs: if-no-files-found: warn # --skip-duplicate allows retrying a workflow that failed with a partial push, skipping already published packages and publishing the rest. + # TODO: Uncomment this block once secrets.NUGET_API_KEY exists # - name: Publish NuGet packages to nuget.org # run: | - # foreach ($pkg in (Get-ChildItem output -Include *.nupkg)) { - # dotnet nuget push $pkg --skip-duplicate --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json + # foreach ($pkg in (Get-ChildItem -Path output -Name -Filter *.nupkg)) { + # dotnet nuget push $pkg --skip-duplicate --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json # } + # env: + # NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} # if: github.event_name != 'pull_request' + - name: Simulate publishing NuGet packages + run: | + foreach ($pkg in (Get-ChildItem -Path output -Name -Filter *.nupkg)) { + echo "would push $pkg" + } + if: github.event_name == 'pull_request' + # All the following are used only when building an installer after a merge - name: Build Msi id: build_msi From 33cef7bbc12abe0406178bd8cc9a834826ec1489 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Tue, 2 Jul 2024 11:12:07 +0700 Subject: [PATCH 04/11] Delete package publishing simulation No longer needed now that testing is completed. --- .github/workflows/ci-cd.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 0f751508..f5f1fe27 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -118,13 +118,6 @@ jobs: # NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} # if: github.event_name != 'pull_request' - - name: Simulate publishing NuGet packages - run: | - foreach ($pkg in (Get-ChildItem -Path output -Name -Filter *.nupkg)) { - echo "would push $pkg" - } - if: github.event_name == 'pull_request' - # All the following are used only when building an installer after a merge - name: Build Msi id: build_msi From d995ad583ccdf4657b7b4dfa888f0b6b47989c87 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Thu, 4 Jul 2024 16:13:41 +0700 Subject: [PATCH 05/11] Use correct name for NuGet API key secret It's an org secret: no need to add it to the repo, it's already there. --- .github/workflows/ci-cd.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index f5f1fe27..b8b405fe 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -108,15 +108,14 @@ jobs: if-no-files-found: warn # --skip-duplicate allows retrying a workflow that failed with a partial push, skipping already published packages and publishing the rest. - # TODO: Uncomment this block once secrets.NUGET_API_KEY exists - # - name: Publish NuGet packages to nuget.org - # run: | - # foreach ($pkg in (Get-ChildItem -Path output -Name -Filter *.nupkg)) { - # dotnet nuget push $pkg --skip-duplicate --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json - # } - # env: - # NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} - # if: github.event_name != 'pull_request' + - name: Publish NuGet packages to nuget.org + run: | + foreach ($pkg in (Get-ChildItem -Path output -Name -Filter *.nupkg)) { + dotnet nuget push $pkg --skip-duplicate --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json + } + env: + NUGET_API_KEY: ${{ secrets.SILLSDEV_PUBLISH_NUGET_ORG }} + if: github.event_name != 'pull_request' # All the following are used only when building an installer after a merge - name: Build Msi From 7b81fc4570a84372d6d49f833496500d6d7aa86e Mon Sep 17 00:00:00 2001 From: Christopher Hirt Date: Mon, 8 Jul 2024 10:10:28 +0700 Subject: [PATCH 06/11] remove Appveyor CI --- appveyor.yml | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index fb054a7f..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,47 +0,0 @@ -version: '{build}' -branches: - only: - - develop -image: Visual Studio 2022 -init: - - cmd: | - set GITVERSION_BUILD_NUMBER=%APPVEYOR_BUILD_NUMBER% - if defined APPVEYOR_PULL_REQUEST_NUMBER set GitVersion_NoNormalizeEnabled=true - if defined APPVEYOR_PULL_REQUEST_NUMBER set IGNORE_NORMALISATION_GIT_HEAD_MOVE=1 -install: - - choco install gitversion.portable -pre -y -nuget: - disable_publish_on_pr: true - disable_publish_octopus: true -before_build: - - pwsh: | - if ($APPVEYOR_PULL_REQUEST_NUMBER) - { - git checkout -b PR-$APPVEYOR_PULL_REQUEST_NUMBER - gitversion /l console /output buildserver /nonormalize - } - else - { - gitversion /l console /output buildserver - } - - cmd: | - msbuild l10n\l10n.proj /t:restore - msbuild l10n\l10n.proj /t:CopyL10nsToDistFiles -build: - project: build/FLExBridge.proj - publish_nuget: true - publish_nuget_symbols: true - use_snupkg_format: true - verbosity: normal -test: off -artifacts: -- path: output/*nupkg - name: nuget -deploy: -- provider: Environment - name: sil-lsdev nuget -notifications: -- provider: GitHubPullRequest - on_build_success: false - on_build_failure: false - on_build_status_changed: false From ec793942d766af15df4ee5a25810b01f0cdfbe97 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Tue, 9 Jul 2024 08:54:50 +0700 Subject: [PATCH 07/11] Push PR-built NuGet packages to int.nugettest.org --- .github/workflows/ci-cd.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index b8b405fe..92ddf781 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -117,6 +117,15 @@ jobs: NUGET_API_KEY: ${{ secrets.SILLSDEV_PUBLISH_NUGET_ORG }} if: github.event_name != 'pull_request' + - name: "PR: Publish NuGet packages to int.nugettest.org" + run: | + foreach ($pkg in (Get-ChildItem -Path output -Name -Filter *.nupkg)) { + dotnet nuget push $pkg --skip-duplicate --api-key $env:NUGET_API_KEY --source https://apiint.nugettest.org/v3/index.json + } + env: + NUGET_API_KEY: ${{ secrets.SILLSDEV_PUBLISH_NUGET_ORG }} + if: github.event_name == 'pull_request' + # All the following are used only when building an installer after a merge - name: Build Msi id: build_msi From 6faf499bb3c84558be650a098956d9d85cd3e781 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Tue, 9 Jul 2024 09:05:51 +0700 Subject: [PATCH 08/11] Fix path to NuGet files --- .github/workflows/ci-cd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 92ddf781..ba20c885 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -111,7 +111,7 @@ jobs: - name: Publish NuGet packages to nuget.org run: | foreach ($pkg in (Get-ChildItem -Path output -Name -Filter *.nupkg)) { - dotnet nuget push $pkg --skip-duplicate --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json + dotnet nuget push output/$pkg --skip-duplicate --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json } env: NUGET_API_KEY: ${{ secrets.SILLSDEV_PUBLISH_NUGET_ORG }} @@ -120,7 +120,7 @@ jobs: - name: "PR: Publish NuGet packages to int.nugettest.org" run: | foreach ($pkg in (Get-ChildItem -Path output -Name -Filter *.nupkg)) { - dotnet nuget push $pkg --skip-duplicate --api-key $env:NUGET_API_KEY --source https://apiint.nugettest.org/v3/index.json + dotnet nuget push output/$pkg --skip-duplicate --api-key $env:NUGET_API_KEY --source https://apiint.nugettest.org/v3/index.json } env: NUGET_API_KEY: ${{ secrets.SILLSDEV_PUBLISH_NUGET_ORG }} From c8964c00b8ed80e89ba42a2b68f6ec22d9e0ecc2 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Tue, 9 Jul 2024 09:06:08 +0700 Subject: [PATCH 09/11] Push .snupkg files as well as .nupkg --- .github/workflows/ci-cd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index ba20c885..672bc227 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -110,7 +110,7 @@ jobs: # --skip-duplicate allows retrying a workflow that failed with a partial push, skipping already published packages and publishing the rest. - name: Publish NuGet packages to nuget.org run: | - foreach ($pkg in (Get-ChildItem -Path output -Name -Filter *.nupkg)) { + foreach ($pkg in (Get-ChildItem -Path output -Name -Filter *nupkg)) { dotnet nuget push output/$pkg --skip-duplicate --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json } env: @@ -119,7 +119,7 @@ jobs: - name: "PR: Publish NuGet packages to int.nugettest.org" run: | - foreach ($pkg in (Get-ChildItem -Path output -Name -Filter *.nupkg)) { + foreach ($pkg in (Get-ChildItem -Path output -Name -Filter *nupkg)) { dotnet nuget push output/$pkg --skip-duplicate --api-key $env:NUGET_API_KEY --source https://apiint.nugettest.org/v3/index.json } env: From 2924839870b3a8b7b2caa11a8511f83268b6334b Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Tue, 9 Jul 2024 09:30:59 +0700 Subject: [PATCH 10/11] Continue workflow if pushing NuGet packages fails --- .github/workflows/ci-cd.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 672bc227..6c3c496b 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -116,6 +116,7 @@ jobs: env: NUGET_API_KEY: ${{ secrets.SILLSDEV_PUBLISH_NUGET_ORG }} if: github.event_name != 'pull_request' + continue-on-error: true - name: "PR: Publish NuGet packages to int.nugettest.org" run: | @@ -125,6 +126,7 @@ jobs: env: NUGET_API_KEY: ${{ secrets.SILLSDEV_PUBLISH_NUGET_ORG }} if: github.event_name == 'pull_request' + continue-on-error: true # All the following are used only when building an installer after a merge - name: Build Msi From 60ed0036e87cb62e3c3397d671ef6446eab4276a Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Tue, 9 Jul 2024 09:32:44 +0700 Subject: [PATCH 11/11] Don't push to int.nugettest.org yet We'll do this in a separate PR. --- .github/workflows/ci-cd.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 6c3c496b..e1bd6490 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -118,16 +118,6 @@ jobs: if: github.event_name != 'pull_request' continue-on-error: true - - name: "PR: Publish NuGet packages to int.nugettest.org" - run: | - foreach ($pkg in (Get-ChildItem -Path output -Name -Filter *nupkg)) { - dotnet nuget push output/$pkg --skip-duplicate --api-key $env:NUGET_API_KEY --source https://apiint.nugettest.org/v3/index.json - } - env: - NUGET_API_KEY: ${{ secrets.SILLSDEV_PUBLISH_NUGET_ORG }} - if: github.event_name == 'pull_request' - continue-on-error: true - # All the following are used only when building an installer after a merge - name: Build Msi id: build_msi