From a6b3fce0dd6279dd9e04ac43a58a8dfe4af31215 Mon Sep 17 00:00:00 2001 From: Aptivi Date: Wed, 5 Feb 2025 11:22:32 +0300 Subject: [PATCH] int - Added release canary workflow --- The release canary workflow pushes to GitHub Package Registry. --- Type: int Breaking: False Doc Required: False Backport Required: False Part: 1/1 --- .github/workflows/build-rel.yml | 44 --------------------- .github/workflows/build.yml | 44 --------------------- .github/workflows/release-canary.yml | 59 ++++++++++++++++++++++++++++ tools/push.cmd | 4 +- tools/push.sh | 8 +++- 5 files changed, 68 insertions(+), 91 deletions(-) create mode 100644 .github/workflows/release-canary.yml diff --git a/.github/workflows/build-rel.yml b/.github/workflows/build-rel.yml index a65c5d0ebd..9798eef5eb 100644 --- a/.github/workflows/build-rel.yml +++ b/.github/workflows/build-rel.yml @@ -40,48 +40,4 @@ jobs: with: name: unit-test-log-ms-${{ matrix.runs-on }} path: "private/Nitrocid.Tests/KSTest/net8.0/TestResults" - - wix-amd64: - strategy: - fail-fast: false - runs-on: "windows-latest" - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.ref }} - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.0.x' - - name: Solution Compilation - run: cd tools ; ./build.cmd ; cd .. - - name: Installer Solution Compilation - run: dotnet build -p:Configuration=Release -p:Platform=x64 public/Nitrocid.Installers/Nitrocid.Installer.sln - - uses: actions/upload-artifact@v4 - with: - name: installer-x64-msi - path: "public/Nitrocid.Installers/Nitrocid.InstallerBundle/bin/x64/Release" - - wix-arm64: - strategy: - fail-fast: false - runs-on: "windows-latest" - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.ref }} - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.0.x' - - name: Solution Compilation - run: cd tools ; ./build.cmd ; cd .. - - name: Installer Solution Compilation - run: dotnet build -p:Configuration=Release -p:Platform=ARM64 public/Nitrocid.Installers/Nitrocid.Installer.sln - - uses: actions/upload-artifact@v4 - with: - name: installer-arm64-msi - path: "public/Nitrocid.Installers/Nitrocid.InstallerBundle/bin/ARM64/Release" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ec7ba7356e..60cd4969aa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,48 +40,4 @@ jobs: with: name: unit-test-log-ms-${{ matrix.runs-on }} path: "private/Nitrocid.Tests/KSTest/net8.0/TestResults" - - wix-amd64: - strategy: - fail-fast: false - runs-on: "windows-latest" - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.ref }} - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.0.x' - - name: Solution Compilation - run: cd tools ; ./build.cmd Debug ; cd .. - - name: Installer Solution Compilation - run: dotnet build -p:Platform=x64 public/Nitrocid.Installers/Nitrocid.Installer.sln - - uses: actions/upload-artifact@v4 - with: - name: installer-x64-msi - path: "public/Nitrocid.Installers/Nitrocid.InstallerBundle/bin/x64/Debug" - - wix-arm64: - strategy: - fail-fast: false - runs-on: "windows-latest" - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.ref }} - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.0.x' - - name: Solution Compilation - run: cd tools ; ./build.cmd Debug ; cd .. - - name: Installer Solution Compilation - run: dotnet build -p:Platform=ARM64 public/Nitrocid.Installers/Nitrocid.Installer.sln - - uses: actions/upload-artifact@v4 - with: - name: installer-arm64-msi - path: "public/Nitrocid.Installers/Nitrocid.InstallerBundle/bin/ARM64/Debug" diff --git a/.github/workflows/release-canary.yml b/.github/workflows/release-canary.yml new file mode 100644 index 0000000000..11d9668881 --- /dev/null +++ b/.github/workflows/release-canary.yml @@ -0,0 +1,59 @@ +name: Prepare release (canary) + +on: + push: + branches: [ "main", "v0.1.0.x-saas", "v0.1.1.x-saas", "v0.1.2.x-saas" ] + pull_request: + branches: [ "main", "v0.1.0.x-saas", "v0.1.1.x-saas", "v0.1.2.x-saas" ] + +jobs: + build: + + runs-on: windows-latest + permissions: + id-token: write + contents: write + attestations: write + packages: write + steps: + - uses: actions/checkout@v4 + with: + submodules: 'true' + ref: ${{ github.ref }} + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + - name: Setup DocFX + run: dotnet tool install --global docfx + - name: Release Asset Preparation + run: | + cd tools ; cmd.exe /c "build.cmd Debug -p:ContinuousIntegrationBuild=true" ; cd .. + cd tools ; cmd.exe /c "pack.cmd" ; cd .. + cd tools ; cmd.exe /c "docgen.cmd" ; cd .. + cd tools ; cmd.exe /c "docgen-pack.cmd" ; cd .. + dotnet build -p:Configuration=Debug -p:Platform=x64 public/Nitrocid.Installers/Nitrocid.Installer.sln + dotnet build -p:Configuration=Debug -p:Platform=ARM64 public/Nitrocid.Installers/Nitrocid.Installer.sln + Move-Item public/Nitrocid.Installers/Nitrocid.InstallerBundle/bin/x64/Debug/Nitrocid.InstallerBundle.exe tools/nitrocid-win-x64-installer.exe + Move-Item public/Nitrocid.Installers/Nitrocid.InstallerBundle/bin/ARM64/Debug/Nitrocid.InstallerBundle.exe tools/nitrocid-win-arm64-installer.exe + - uses: actions/upload-artifact@v4 + with: + name: installer-x64-msi + path: "public/Nitrocid.Installers/Nitrocid.InstallerBundle/bin/x64/Release" + - uses: actions/upload-artifact@v4 + with: + name: installer-arm64-msi + path: "public/Nitrocid.Installers/Nitrocid.InstallerBundle/bin/ARM64/Release" + - uses: actions/upload-artifact@v4 + with: + name: nks-build + path: "public/Nitrocid/KSBuild" + - uses: actions/upload-artifact@v4 + with: + name: nks-analyzer + path: "public/Nitrocid/KSAnalyzer" + - name: Package Publication + run: | + dotnet nuget add source --username AptiviCEO --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Aptivi/index.json" + chmod +x tools/*.sh + cd tools ; cmd.exe /C "push.cmd ${{ secrets.GITHUB_TOKEN }} github" ; cd .. diff --git a/tools/push.cmd b/tools/push.cmd index 75ddbabff9..8847433590 100644 --- a/tools/push.cmd +++ b/tools/push.cmd @@ -1,9 +1,11 @@ @echo off set apikey=%1 +set source=%2 +if "%source%" == "" set source=nuget.org REM This script pushes. Use when you have VS installed. echo Pushing... -cmd /C "forfiles /s /m *.nupkg /p ..\ /C "cmd /c dotnet nuget push @path --api-key %apikey% --source nuget.org"" +cmd /C "forfiles /s /m *.nupkg /p ..\ /C "cmd /c dotnet nuget push @path --api-key %apikey% --source %source%"" if %errorlevel% == 0 goto :success echo There was an error trying to push (%errorlevel%). goto :finished diff --git a/tools/push.sh b/tools/push.sh index 8c7f65c141..a763c9488a 100644 --- a/tools/push.sh +++ b/tools/push.sh @@ -29,12 +29,16 @@ checkerror() { # This script pushes. Use when you have dotnet installed. dotnetpath=`which dotnet` checkerror $? "dotnet is not found" +nugetsource=$1 +if [ -z $nugetsource ]; then + nugetsource=nuget.org +fi # Push packages echo Pushing packages... -find ../public/Nitrocid/KSBuild/ -maxdepth 1 -type f -name "*.nupkg" -exec dotnet nuget push {} --api-key $NUGET_APIKEY --source "nuget.org" \; +find ../public/Nitrocid/KSBuild/ -maxdepth 1 -type f -name "*.nupkg" -exec dotnet nuget push {} --api-key $NUGET_APIKEY --source "$nugetsource" \; checkerror $? "Failed to push" -find ../public/Nitrocid/KSAnalyzer/ -maxdepth 1 -type f -name "*.nupkg" -exec dotnet nuget push {} --api-key $NUGET_APIKEY --source "nuget.org" \; +find ../public/Nitrocid/KSAnalyzer/ -maxdepth 1 -type f -name "*.nupkg" -exec dotnet nuget push {} --api-key $NUGET_APIKEY --source "$nugetsource" \; checkerror $? "Failed to push" # Inform success