30
30
msbuild -version
31
31
msbuild "./AuthorizeNET.sln" -property:Configuration=Release -t:rebuild
32
32
Write-Output "Build Successful"
33
+ nuget pack AuthorizeNet.nuspec
34
+
35
+ - name : Upload Rest Client SDK Nupkg
36
+ uses : actions/upload-artifact@v4
37
+ with :
38
+ name : sdk-nupkg
39
+ path : ${{env.sdk_dotnet}}/*.nupkg
33
40
34
41
- name : Run UnitTests
35
42
uses : josepho0918/vstest-action@main
@@ -61,10 +68,17 @@ jobs:
61
68
needs : workflow-job-build
62
69
runs-on : ${{matrix.operating-system}}
63
70
steps :
71
+ - name : Download the Built Rest Client for Dotnet from previous Job
72
+ uses : actions/download-artifact@v4
73
+ with :
74
+ name : sdk-nupkg
75
+ path : sdk-nupkg
76
+
64
77
- name : Recreate SDK Folder structure
65
78
shell : pwsh
66
79
run : |
67
80
If(!(Test-Path -PathType container "${{env.sdk_dotnet}}/Authorize.NET/bin/Release")) { md ${{env.sdk_dotnet}}/Authorize.NET/bin/Release }
81
+
68
82
- name : Download the SDK from previous job
69
83
uses : actions/download-artifact@v4
70
84
with :
@@ -84,18 +98,25 @@ jobs:
84
98
- name : Compile the Sample Application
85
99
shell : pwsh
86
100
run : |
101
+ $clientSdkFolderName = (Get-ChildItem -Path sdk-nupkg -Filter "*nupkg" | Select-Object -First 1).BaseName
102
+ $clientSdkVersion = $clientSdkFolderName.Substring(13)
103
+ nuget Sources Add -Name "temperory_nuget_source" -Source ((Get-Location).Path + "\sdk-nupkg")
104
+
87
105
cd $Env:sample_code_csharp
88
- nuget install ./packages.config -OutputDirectory packages
89
- nuget install ./SampleCodeTest/packages.config -OutputDirectory packages
90
-
91
- (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
92
-
93
- (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
106
+ (Get-Content ./packages.config) | ForEach-Object { $_ -replace '.*<package\s*id="AuthorizeNet".*\/>', "<package id=`"AuthorizeNet`" version=`"$clientSdkVersion`" targetFramework=`"net461`" />" } | Set-Content ./packages.config
107
+ (Get-Content ./packages.config) | ForEach-Object { $_ -replace '.*<package\s*id="AuthorizeNet".*\/>', "<package id=`"AuthorizeNet`" version=`"$clientSdkVersion`" targetFramework=`"net461`" />" } | Set-Content ./packages.config
108
+
109
+ nuget install ./packages.config -OutputDirectory packages -Source temporary_nuget_source -Source https://api.nuget.org/v3/index.json
110
+ nuget install ./SampleCodeTest/packages.config -OutputDirectory packages -Source temporary_nuget_source -Source https://api.nuget.org/v3/index.json
111
+
112
+ (Get-Content ./SampleCode.csproj) | ForEach-Object { $_ -replace "(<HintPath>)(.)+(AuthorizeNet.dll</HintPath>)", "<HintPath>packages\\$clientSdkFolderName\\lib\\AuthorizeNet.dll</HintPath>" } | Set-Content ./SampleCode.csproj
113
+
114
+ (Get-Content ./SampleCodeTest/SampleCodeTest.csproj) | ForEach-Object { $_ -replace "(<HintPath>)(.)+(AuthorizeNet.dll</HintPath>)", "<HintPath>packages\\$clientSdkFolderName\\lib\\AuthorizeNet.dll</HintPath>" } | Set-Content ./SampleCodeTest/SampleCodeTest.csproj
94
115
95
116
(Get-Content ./SampleCode.csproj) | ForEach-Object { $_ -replace "(<TargetFrameworkVersion>)(.)+(</TargetFrameworkVersion>)", "<TargetFrameworkVersion>v${{matrix.net-framework-version}}</TargetFrameworkVersion>" } | Set-Content ./SampleCode.csproj
96
117
97
118
(Get-Content ./SampleCodeTest/SampleCodeTest.csproj) | ForEach-Object { $_ -replace "(<TargetFrameworkVersion>)(.)+(</TargetFrameworkVersion>)", "<TargetFrameworkVersion>v${{matrix.net-framework-version}}</TargetFrameworkVersion>" } | Set-Content ./SampleCodeTest/SampleCodeTest.csproj
98
-
119
+
99
120
msbuild -version
100
121
msbuild "./SampleCode.sln" -property:Configuration=Debug -t:rebuild
101
122
Write-Output "Build Successful"
0 commit comments