1
- # Gets the version suffix from the repo tag
2
- # example: v1.0.0-preview1-final => preview1-final
3
- function Get-Version-Suffix-From-Tag {
4
- $tag = $env: APPVEYOR_REPO_TAG_NAME
5
- $split = $tag -split " -"
6
- $suffix = $split [1 .. 2 ]
7
- $final = $suffix -join " -"
8
- return $final
9
- }
10
-
11
1
function CheckLastExitCode {
12
2
param ([int []]$SuccessCodes = @ (0 ), [scriptblock ]$CleanupScript = $null )
13
3
14
4
if ($SuccessCodes -notcontains $LastExitCode ) {
15
- throw " EXE RETURNED EXIT CODE $LastExitCode "
5
+ throw " Executable returned exist code $LastExitCode "
16
6
}
17
7
}
18
8
@@ -64,7 +54,9 @@ function RunCleanupCode {
64
54
65
55
function ReportCodeCoverage {
66
56
if ($env: APPVEYOR ) {
67
- dotnet codecov -f " **\coverage.cobertura.xml"
57
+ if ($IsWindows ) {
58
+ dotnet codecov -f " **\coverage.cobertura.xml"
59
+ }
68
60
}
69
61
else {
70
62
dotnet reportgenerator - reports:** \coverage.cobertura.xml - targetdir:artifacts\coverage
@@ -73,8 +65,43 @@ function ReportCodeCoverage {
73
65
CheckLastExitCode
74
66
}
75
67
76
- $revision = @ { $true = $env: APPVEYOR_BUILD_NUMBER ; $false = 1 }[$env: APPVEYOR_BUILD_NUMBER -ne $NULL ];
77
- $revision = " {0:D4}" -f [convert ]::ToInt32($revision , 10 )
68
+ # Gets the version suffix from the repo tag
69
+ # example: v1.0.0-preview1-final => preview1-final
70
+ function GetVersionSuffixFromTag {
71
+ $tag = $env: APPVEYOR_REPO_TAG_NAME
72
+ $split = $tag -split " -"
73
+ $suffix = $split [1 .. 2 ]
74
+ $final = $suffix -join " -"
75
+ return $final
76
+ }
77
+
78
+ function CreateNuGetPackage {
79
+ if ($env: APPVEYOR_REPO_TAG -eq $true ) {
80
+ $revision = GetVersionSuffixFromTag
81
+ Write-Output " APPVEYOR_REPO_TAG: $env: APPVEYOR_REPO_TAG "
82
+ Write-Output " VERSION-SUFFIX: $revision "
83
+
84
+ if ([string ]::IsNullOrWhitespace($revision )) {
85
+ Write-Output " RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts"
86
+ dotnet pack .\src\JsonApiDotNetCore - c Release - o .\artifacts
87
+ }
88
+ else {
89
+ Write-Output " RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=$revision "
90
+ dotnet pack .\src\JsonApiDotNetCore - c Release - o .\artifacts -- version- suffix= $revision
91
+ }
92
+ }
93
+ else {
94
+ $revision = @ { $true = $env: APPVEYOR_BUILD_NUMBER ; $false = 1 }[$env: APPVEYOR_BUILD_NUMBER -ne $NULL ];
95
+ $revision = " {0:D4}" -f [convert ]::ToInt32($revision , 10 )
96
+
97
+ $packageVersionSuffix = " pre-$revision "
98
+ Write-Output " VERSION-SUFFIX: $packageVersionSuffix "
99
+ Write-Output " RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=$packageVersionSuffix "
100
+ dotnet pack .\src\JsonApiDotNetCore - c Release - o .\artifacts -- version- suffix= $packageVersionSuffix
101
+ }
102
+
103
+ CheckLastExitCode
104
+ }
78
105
79
106
dotnet tool restore
80
107
CheckLastExitCode
@@ -91,27 +118,4 @@ CheckLastExitCode
91
118
92
119
ReportCodeCoverage
93
120
94
- Write-Output " APPVEYOR_REPO_TAG: $env: APPVEYOR_REPO_TAG "
95
-
96
- if ($env: APPVEYOR_REPO_TAG -eq $true ) {
97
- $revision = Get-Version - Suffix- From- Tag
98
- Write-Output " VERSION-SUFFIX: $revision "
99
-
100
- if ([string ]::IsNullOrWhitespace($revision )) {
101
- Write-Output " RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts"
102
- dotnet pack .\src\JsonApiDotNetCore - c Release - o .\artifacts
103
- CheckLastExitCode
104
- }
105
- else {
106
- Write-Output " RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=$revision "
107
- dotnet pack .\src\JsonApiDotNetCore - c Release - o .\artifacts -- version- suffix= $revision
108
- CheckLastExitCode
109
- }
110
- }
111
- else {
112
- $packageVersionSuffix = " pre-$revision "
113
- Write-Output " VERSION-SUFFIX: $packageVersionSuffix "
114
- Write-Output " RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=$packageVersionSuffix "
115
- dotnet pack .\src\JsonApiDotNetCore - c Release - o .\artifacts -- version- suffix= $packageVersionSuffix
116
- CheckLastExitCode
117
- }
121
+ CreateNuGetPackage
0 commit comments