@@ -2,12 +2,22 @@ name: build
2
2
3
3
on :
4
4
push :
5
- branches : [ dev, rel/* ]
5
+ branches : [ dev* , rel/* ]
6
6
tags : [ '*' ]
7
7
pull_request :
8
- branches : [ dev, rel/* ]
8
+ branches : [ dev* , rel/* ]
9
9
workflow_dispatch :
10
10
11
+ env :
12
+ DOTNET_MULTILEVEL_LOOKUP : 0
13
+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE : 1
14
+ DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION : 1
15
+ NUGET_XMLDOC_MODE : skip
16
+ TERM : xterm
17
+
18
+ permissions :
19
+ contents : read
20
+
11
21
jobs :
12
22
build :
13
23
name : ${{ matrix.os }}
@@ -54,19 +64,11 @@ jobs:
54
64
- name : Build, Test and Package
55
65
if : ${{ runner.os == 'Windows' }}
56
66
run : eng\common\CIBuild.cmd -configuration Release -prepareMachine
57
- env :
58
- DOTNET_MULTILEVEL_LOOKUP : 0
59
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE : 1
60
- NUGET_XMLDOC_MODE : skip
61
67
62
68
- name : Build, Test and Package
63
69
shell : pwsh
64
70
if : ${{ runner.os != 'Windows' }}
65
71
run : ./eng/common/cibuild.sh -configuration Release -prepareMachine
66
- env :
67
- DOTNET_MULTILEVEL_LOOKUP : 0
68
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE : 1
69
- NUGET_XMLDOC_MODE : skip
70
72
71
73
- name : Publish logs
72
74
uses : actions/upload-artifact@v3
@@ -88,10 +90,72 @@ jobs:
88
90
name : testresults-${{ matrix.os_name }}
89
91
path : ./artifacts/TestResults/Release
90
92
93
+ validate-packages :
94
+ needs : build
95
+ runs-on : ubuntu-latest
96
+ steps :
97
+
98
+ - name : Download packages
99
+ uses : actions/download-artifact@v3
100
+ with :
101
+ name : packages-windows
102
+
103
+ - name : Setup .NET SDK
104
+ uses : actions/setup-dotnet@v3
105
+
106
+ - name : Validate NuGet packages
107
+ shell : pwsh
108
+ run : |
109
+ dotnet tool install --global dotnet-validate --version 0.0.1-preview.304
110
+ $packages = Get-ChildItem -Filter "*.nupkg" | ForEach-Object { $_.FullName }
111
+ $invalidPackages = 0
112
+ foreach ($package in $packages) {
113
+ dotnet validate package local $package
114
+ if ($LASTEXITCODE -ne 0) {
115
+ $invalidPackages++
116
+ }
117
+ }
118
+ if ($invalidPackages -gt 0) {
119
+ Write-Output "::error::$invalidPackages NuGet package(s) failed validation."
120
+ }
121
+
122
+ publish-myget :
123
+ needs : validate-packages
124
+ runs-on : ubuntu-latest
125
+ if : |
126
+ github.event.repository.fork == false &&
127
+ (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) ||
128
+ startsWith(github.ref, 'refs/heads/dev') ||
129
+ startsWith(github.ref, 'refs/heads/rel/') ||
130
+ startsWith(github.ref, 'refs/tags/'))
131
+ steps :
132
+
133
+ - name : Download packages
134
+ uses : actions/download-artifact@v3
135
+ with :
136
+ name : packages-windows
137
+
138
+ - name : Setup .NET SDK
139
+ uses : actions/setup-dotnet@v3
140
+
91
141
- name : Push NuGet packages to aspnet-contrib MyGet
92
- if : ${{ github.repository_owner == 'aspnet-contrib' && (github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/heads/rel/') || startsWith(github.ref, 'refs/tags/')) && runner.os == 'Windows' }}
93
- run : nuget push "artifacts\packages\Release\Shipping\*.nupkg" -ApiKey ${{ secrets.MYGET_API_KEY }} -SkipDuplicate -Source https://www.myget.org/F/aspnet-contrib/api/v3/index.json
142
+ run : nuget push "*.nupkg" -ApiKey ${{ secrets.MYGET_API_KEY }} -SkipDuplicate -Source https://www.myget.org/F/aspnet-contrib/api/v3/index.json
143
+
144
+ publish-nuget :
145
+ needs : validate-packages
146
+ runs-on : ubuntu-latest
147
+ if : |
148
+ github.event.repository.fork == false &&
149
+ startsWith(github.ref, 'refs/tags/')
150
+ steps :
151
+
152
+ - name : Download packages
153
+ uses : actions/download-artifact@v3
154
+ with :
155
+ name : packages-windows
156
+
157
+ - name : Setup .NET SDK
158
+ uses : actions/setup-dotnet@v3
94
159
95
160
- name : Push NuGet packages to NuGet.org
96
- if : ${{ github.repository_owner == 'aspnet-contrib' && startsWith(github.ref, 'refs/tags/') && runner.os == 'Windows' }}
97
- run : nuget push "artifacts\packages\Release\Shipping\*.nupkg" -ApiKey ${{ secrets.NUGET_API_KEY }} -SkipDuplicate -Source https://api.nuget.org/v3/index.json
161
+ run : nuget push "*.nupkg" -ApiKey ${{ secrets.NUGET_API_KEY }} -SkipDuplicate -Source https://api.nuget.org/v3/index.json
0 commit comments