Skip to content

Commit 48be680

Browse files
Initial test for signing packages (push to PR feed to validate)
1 parent d3a1be7 commit 48be680

File tree

2 files changed

+74
-12
lines changed

2 files changed

+74
-12
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/CommunityToolkit.*

.github/workflows/build.yml

Lines changed: 73 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ env:
2424
COREHOST_TRACEFILE: corehosttrace.log
2525
MULTI_TARGET_DIRECTORY: tooling/MultiTarget
2626
HEADS_DIRECTORY: tooling/ProjectHeads
27+
IS_MAIN: ${{ github.ref == 'refs/heads/main' }}
28+
IS_PR: ${{ startsWith(github.ref, 'refs/pull/') }}
29+
IS_RELEASE: ${{ startsWith(github.ref, 'refs/heads/rel/') }}
2730

2831
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
2932
jobs:
@@ -120,9 +123,9 @@ jobs:
120123
run: powershell -version 5.1 -command "./tooling/GenerateAllSolution.ps1 -IncludeHeads ${{ env.TEST_PLATFORM }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}" -ErrorAction Stop
121124

122125
- name: Enable Uno.WinUI (in WinUI3 matrix only)
126+
if: ${{ matrix.platform == 'WinUI3' }}
123127
working-directory: ./${{ env.MULTI_TARGET_DIRECTORY }}
124128
run: powershell -version 5.1 -command "./UseUnoWinUI.ps1 3" -ErrorAction Stop
125-
if: ${{ matrix.platform == 'WinUI3' }}
126129

127130
- name: MSBuild
128131
run: msbuild.exe CommunityToolkit.AllComponents.sln /restore /nowarn:MSB4011 -p:Configuration=Release -m ${{ env.VERSION_PROPERTY }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '/bl' || '' }} -v:${{ env.MSBUILD_VERBOSITY }}
@@ -132,17 +135,12 @@ jobs:
132135
working-directory: ./tooling/Scripts/
133136
run: ./PackEachExperiment.ps1 -extraBuildProperties "${{ env.VERSION_PROPERTY }}"
134137

135-
# Push Packages to our DevOps Artifacts Feed (see nuget.config)
136-
- name: Add source (main)
137-
if: ${{ github.ref == 'refs/heads/main' }}
138-
run: dotnet nuget update source MainLatest --username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
139-
140-
- name: Add source (pull requests)
141-
if: ${{ github.ref != 'refs/heads/main' }}
142-
run: dotnet nuget add source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-PullRequests/nuget/v3/index.json --name PullRequests --username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
143-
144-
- name: Push packages
145-
run: dotnet nuget push "**/*.nupkg" --api-key dummy --source ${{ github.ref == 'refs/heads/main' && 'MainLatest' || 'PullRequests' }} --skip-duplicate
138+
# Push Pull Request Packages to our DevOps Artifacts Feed (see nuget.config)
139+
- name: Push Pull Request Packages
140+
if: ${{ env.IS_PR }}
141+
run: |
142+
dotnet nuget add source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-PullRequests/nuget/v3/index.json --name PullRequests --username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
143+
dotnet nuget push "**/*.nupkg" --api-key dummy --source PullRequests --skip-duplicate
146144
147145
# Run tests
148146
- name: Setup VSTest Path
@@ -201,6 +199,69 @@ jobs:
201199
dotnet tool install --global dotnet-dump
202200
dotnet-dump analyze ${{ steps.detect-dump.outputs.DUMP_FILE }} -c "clrstack" -c "pe -lines" -c "exit"
203201
202+
# if we're not doing a PR build then we upload our packages so we can sign as a separate job.
203+
- name: Upload Packages as Artifacts
204+
uses: actions/upload-artifact@v3
205+
# TODO: if: ${{ env.IS_PR == false }}
206+
with:
207+
name: nuget-packages-${{ matrix.platform }}
208+
if-no-files-found: error
209+
path: |
210+
**/*.nupkg
211+
212+
sign:
213+
needs: [build]
214+
# TODO: if: ${{ env.IS_MAIN }}
215+
runs-on: windows-latest
216+
217+
strategy:
218+
fail-fast: false # prevent one matrix pipeline from being cancelled if one fails, we want them both to run to completion.
219+
matrix:
220+
platform: [WinUI2, WinUI3]
221+
222+
steps:
223+
- name: Checkout Repository
224+
uses: actions/checkout@v3
225+
226+
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
227+
uses: actions/setup-dotnet@v3
228+
with:
229+
dotnet-version: ${{ env.DOTNET_VERSION }}
230+
231+
- name: Download built packages for ${{ matrix.platform }}
232+
uses: actions/download-artifact@v3
233+
with:
234+
name: nuget-packages-${{ matrix.platform }}
235+
path: ./packages
236+
237+
- name: Install Signing Tool
238+
run: dotnet tool install --tool-path ./tools sign --version 0.9.1-beta.23356.1
239+
240+
- name: Sign Packages
241+
run: ./tools/sign code azure-key-vault "**/*.nupkg" \
242+
--timestamp-url "http://timestamp.digicert.com" \
243+
--base-directory "${{ github.workspace }}/packages" \
244+
--file-list "${{ github.workspace }}/.github/workflows/SignClientFileList.txt" \
245+
--publisher-name ".NET Foundation" \
246+
--description "Windows Community Toolkit" \
247+
--description-url "https://github.com/CommunityToolkit/Windows" \
248+
--azure-key-vault-certificate "${{ secrets.SIGN_CERTIFICATE }}" \
249+
--azure-key-vault-client-id "${{ secrets.SIGN_CLIENT_ID }}" \
250+
--azure-key-vault-client-secret "${{ secrets.SIGN_CLIENT_SECRET }}" \
251+
--azure-key-vault-tenant-id "${{ secrets.SIGN_TENANT_ID }}" \
252+
--azure-key-vault-url "${{ secrets.SIGN_KEY_VAULT_URL }}"
253+
254+
#- name: Add source (main)
255+
# run: dotnet nuget update source MainLatest --username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
256+
257+
# TODO: For now push to PR feed so we can validate if any of this works...
258+
- name: Push Signed Packages
259+
run: |
260+
dotnet nuget add source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-PullRequests/nuget/v3/index.json --name PullRequests --username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
261+
dotnet nuget push "**/*.nupkg" --api-key dummy --source PullRequests --skip-duplicate
262+
263+
# TODO: If release we should push to NuGet
264+
204265
wasm-linux:
205266
runs-on: ubuntu-latest
206267

0 commit comments

Comments
 (0)