From e932c9ad937d3b620d48940e968972e539a77199 Mon Sep 17 00:00:00 2001 From: gnongsie Date: Tue, 17 Sep 2024 17:47:58 +0530 Subject: [PATCH] Fixing build versions --- .github/workflows/dotnet-workflow.yml | 35 +++++++++++++++++++++------ 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dotnet-workflow.yml b/.github/workflows/dotnet-workflow.yml index 579607e..70b20f0 100644 --- a/.github/workflows/dotnet-workflow.yml +++ b/.github/workflows/dotnet-workflow.yml @@ -30,6 +30,13 @@ jobs: msbuild -version msbuild "./AuthorizeNET.sln" -property:Configuration=Release -t:rebuild Write-Output "Build Successful" + nuget pack AuthorizeNet.nuspec + + - name: Upload Rest Client SDK Nupkg + uses: actions/upload-artifact@v4 + with: + name: sdk-nupkg + path: ${{env.sdk_dotnet}}/*.nupkg - name: Run UnitTests uses: josepho0918/vstest-action@main @@ -61,10 +68,17 @@ jobs: needs: workflow-job-build runs-on: ${{matrix.operating-system}} steps: + - name: Download the Built Rest Client for Dotnet from previous Job + uses: actions/download-artifact@v4 + with: + name: sdk-nupkg + path: sdk-nupkg + - name: Recreate SDK Folder structure shell: pwsh run: | If(!(Test-Path -PathType container "${{env.sdk_dotnet}}/Authorize.NET/bin/Release")) { md ${{env.sdk_dotnet}}/Authorize.NET/bin/Release } + - name: Download the SDK from previous job uses: actions/download-artifact@v4 with: @@ -84,18 +98,25 @@ jobs: - name: Compile the Sample Application shell: pwsh run: | + $clientSdkFolderName = (Get-ChildItem -Path sdk-nupkg -Filter "*nupkg" | Select-Object -First 1).BaseName + $clientSdkVersion = $clientSdkFolderName.Substring(13) + nuget Sources Add -Name "temperory_nuget_source" -Source ((Get-Location).Path + "\sdk-nupkg") + cd $Env:sample_code_csharp - nuget install ./packages.config -OutputDirectory packages - nuget install ./SampleCodeTest/packages.config -OutputDirectory packages - - (Get-Content ./SampleCode.csproj) | ForEach-Object { $_ -replace "()(.)+(AuthorizeNet.dll)", "..\\sdk-dotnet\\Authorize.NET\\bin\\Release\\AuthorizeNet.dll" } | Set-Content ./SampleCode.csproj - - (Get-Content ./SampleCodeTest/SampleCodeTest.csproj) | ForEach-Object { $_ -replace "()(.)+(AuthorizeNet.dll)", "..\\..\\sdk-dotnet\\Authorize.NET\\bin\\Release\\AuthorizeNet.dll" } | Set-Content ./SampleCodeTest/SampleCodeTest.csproj + (Get-Content ./packages.config) | ForEach-Object { $_ -replace '.*', "" } | Set-Content ./packages.config + (Get-Content ./packages.config) | ForEach-Object { $_ -replace '.*', "" } | Set-Content ./packages.config + + nuget install ./packages.config -OutputDirectory packages -Source temporary_nuget_source -Source https://api.nuget.org/v3/index.json + nuget install ./SampleCodeTest/packages.config -OutputDirectory packages -Source temporary_nuget_source -Source https://api.nuget.org/v3/index.json + + (Get-Content ./SampleCode.csproj) | ForEach-Object { $_ -replace "()(.)+(AuthorizeNet.dll)", "packages\\$clientSdkFolderName\\lib\\AuthorizeNet.dll" } | Set-Content ./SampleCode.csproj + + (Get-Content ./SampleCodeTest/SampleCodeTest.csproj) | ForEach-Object { $_ -replace "()(.)+(AuthorizeNet.dll)", "packages\\$clientSdkFolderName\\lib\\AuthorizeNet.dll" } | Set-Content ./SampleCodeTest/SampleCodeTest.csproj (Get-Content ./SampleCode.csproj) | ForEach-Object { $_ -replace "()(.)+()", "v${{matrix.net-framework-version}}" } | Set-Content ./SampleCode.csproj (Get-Content ./SampleCodeTest/SampleCodeTest.csproj) | ForEach-Object { $_ -replace "()(.)+()", "v${{matrix.net-framework-version}}" } | Set-Content ./SampleCodeTest/SampleCodeTest.csproj - + msbuild -version msbuild "./SampleCode.sln" -property:Configuration=Debug -t:rebuild Write-Output "Build Successful"