67
67
68
68
env :
69
69
# faux-ternary expression to select which platforms to build for each platform vs. duplicating step below.
70
- TARGET_PLATFORMS : ${{ matrix.platform != 'WinUI3' && ' all' || 'all-uwp' }}
70
+ TARGET_PLATFORMS : all
71
71
TEST_PLATFORM : ${{ matrix.platform != 'WinUI3' && 'UWP' || 'WinAppSdk' }}
72
72
VERSION_PROPERTY : ${{ github.ref == 'refs/heads/main' && format('build.{0}', github.run_number) || format('pull-{0}.{1}', github.event.number, github.run_number) }}
73
73
@@ -132,6 +132,15 @@ jobs:
132
132
run : |
133
133
echo "VERSION_DATE=$(git log -1 --format=%cd --date=format:%y%m%d)" >> $env:GITHUB_ENV
134
134
135
+ # Semver regex: https://regex101.com/r/Ly7O1x/3/
136
+ - name : Format Date/Time of Release Package Version
137
+ if : ${{ env.IS_RELEASE == 'true' }}
138
+ run : |
139
+ $ref = "${{ github.ref }}"
140
+ $ref -match "^refs/heads/rel/(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$"
141
+ echo "VERSION_DATE=$($matches['patch'])" >> $env:GITHUB_ENV
142
+ echo "VERSION_PROPERTY=$($matches['prerelease'])" >> $env:GITHUB_ENV
143
+
135
144
- name : MSBuild
136
145
run : >
137
146
msbuild.exe /restore /nowarn:MSB4011
@@ -150,7 +159,7 @@ jobs:
150
159
151
160
# Push Pull Request Packages to our DevOps Artifacts Feed (see nuget.config)
152
161
- name : Push Pull Request Packages
153
- if : ${{ env.IS_PR }}
162
+ if : ${{ env.IS_PR == 'true' }}
154
163
run : |
155
164
dotnet nuget add source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-PullRequests/nuget/v3/index.json `
156
165
--name PullRequests `
@@ -216,7 +225,7 @@ jobs:
216
225
217
226
- name : Upload Package List
218
227
uses : actions/upload-artifact@v3
219
- # TODO: if: ${{ env.IS_PR == false }}
228
+ if : ${{ env.IS_PR == ' false' }}
220
229
with :
221
230
name : nuget-list
222
231
if-no-files-found : error
@@ -226,7 +235,7 @@ jobs:
226
235
# if we're not doing a PR build then we upload our packages so we can sign as a separate job.
227
236
- name : Upload Packages as Artifacts
228
237
uses : actions/upload-artifact@v3
229
- # TODO: if: ${{ env.IS_PR == false }}
238
+ if : ${{ env.IS_PR == ' false' }}
230
239
with :
231
240
name : nuget-packages-${{ matrix.platform }}
232
241
if-no-files-found : error
@@ -235,7 +244,7 @@ jobs:
235
244
236
245
sign :
237
246
needs : [build]
238
- # TODO: if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/rel/') }}
247
+ if : ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/rel/') }}
239
248
runs-on : windows-latest
240
249
permissions :
241
250
id-token : write # Required for requesting the JWT
@@ -283,17 +292,16 @@ jobs:
283
292
--azure-key-vault-certificate "${{ secrets.SIGN_CERTIFICATE }}"
284
293
--verbosity Information
285
294
286
- # TODO: For now push to PR feed so we can validate if any of this works... change to MainLatest after
287
295
- name : Push Signed Packages
288
296
run : |
289
- dotnet nuget add source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-PullRequests /nuget/v3/index.json `
290
- --name PullRequests `
297
+ dotnet nuget add source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-MainLatest /nuget/v3/index.json `
298
+ --name MainLatest `
291
299
--username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
292
- dotnet nuget push "**/*.nupkg" --api-key dummy --source PullRequests --skip-duplicate
300
+ dotnet nuget push "**/*.nupkg" --api-key dummy --source MainLatest --skip-duplicate
293
301
294
302
- name : Upload Signed Packages as Artifacts (for release)
295
303
uses : actions/upload-artifact@v3
296
- # TODO: if: ${{ env.IS_RELEASE }}
304
+ if : ${{ env.IS_RELEASE == 'true' }}
297
305
with :
298
306
name : signed-nuget-packages-${{ matrix.platform }}
299
307
if-no-files-found : error
0 commit comments