Skip to content

Commit

Permalink
Fixing build versions
Browse files Browse the repository at this point in the history
  • Loading branch information
gnongsie committed Sep 17, 2024
1 parent 4282169 commit e932c9a
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions .github/workflows/dotnet-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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 "(<HintPath>)(.)+(AuthorizeNet.dll</HintPath>)", "<HintPath>..\\sdk-dotnet\\Authorize.NET\\bin\\Release\\AuthorizeNet.dll</HintPath>" } | Set-Content ./SampleCode.csproj
(Get-Content ./SampleCodeTest/SampleCodeTest.csproj) | ForEach-Object { $_ -replace "(<HintPath>)(.)+(AuthorizeNet.dll</HintPath>)", "<HintPath>..\\..\\sdk-dotnet\\Authorize.NET\\bin\\Release\\AuthorizeNet.dll</HintPath>" } | Set-Content ./SampleCodeTest/SampleCodeTest.csproj
(Get-Content ./packages.config) | ForEach-Object { $_ -replace '.*<package\s*id="AuthorizeNet".*\/>', "<package id=`"AuthorizeNet`" version=`"$clientSdkVersion`" targetFramework=`"net461`" />" } | Set-Content ./packages.config
(Get-Content ./packages.config) | ForEach-Object { $_ -replace '.*<package\s*id="AuthorizeNet".*\/>', "<package id=`"AuthorizeNet`" version=`"$clientSdkVersion`" targetFramework=`"net461`" />" } | 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 "(<HintPath>)(.)+(AuthorizeNet.dll</HintPath>)", "<HintPath>packages\\$clientSdkFolderName\\lib\\AuthorizeNet.dll</HintPath>" } | Set-Content ./SampleCode.csproj
(Get-Content ./SampleCodeTest/SampleCodeTest.csproj) | ForEach-Object { $_ -replace "(<HintPath>)(.)+(AuthorizeNet.dll</HintPath>)", "<HintPath>packages\\$clientSdkFolderName\\lib\\AuthorizeNet.dll</HintPath>" } | Set-Content ./SampleCodeTest/SampleCodeTest.csproj
(Get-Content ./SampleCode.csproj) | ForEach-Object { $_ -replace "(<TargetFrameworkVersion>)(.)+(</TargetFrameworkVersion>)", "<TargetFrameworkVersion>v${{matrix.net-framework-version}}</TargetFrameworkVersion>" } | Set-Content ./SampleCode.csproj
(Get-Content ./SampleCodeTest/SampleCodeTest.csproj) | ForEach-Object { $_ -replace "(<TargetFrameworkVersion>)(.)+(</TargetFrameworkVersion>)", "<TargetFrameworkVersion>v${{matrix.net-framework-version}}</TargetFrameworkVersion>" } | Set-Content ./SampleCodeTest/SampleCodeTest.csproj
msbuild -version
msbuild "./SampleCode.sln" -property:Configuration=Debug -t:rebuild
Write-Output "Build Successful"
Expand Down

0 comments on commit e932c9a

Please sign in to comment.