Skip to content

Commit 3605088

Browse files
authored
Merge pull request #690 from CommunityToolkit/ci/releases/scheduled/weekly
Add weekly merge workflow and update CI triggers
2 parents 7d2f3ab + c814f73 commit 3605088

File tree

2 files changed

+142
-3
lines changed

2 files changed

+142
-3
lines changed

.github/workflows/build.yml

Lines changed: 106 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,20 @@ name: CI
88
on:
99
# Triggers the workflow on push or pull request events but only for the main branch
1010
push:
11-
branches: [ main ]
11+
branches: [ main, 'rel/weekly' ]
1212
pull_request:
1313
branches: [ main ]
1414

1515
# Allows you to run this workflow manually from the Actions tab
1616
workflow_dispatch:
1717
merge_group:
1818

19+
# Allow this workflow to be triggered by scheduled release workflows
20+
workflow_run:
21+
workflows: [ weekly-merge ]
22+
types:
23+
- completed
24+
1925
env:
2026
DOTNET_VERSION: ${{ '9.0.x' }}
2127
ENABLE_DIAGNOSTICS: true
@@ -72,7 +78,7 @@ jobs:
7278

7379
env:
7480
MULTI_TARGET_DIRECTORY: tooling/MultiTarget
75-
VERSION_PROPERTY: ${{ github.ref == 'refs/heads/main' && format('build.{0}', github.run_number) || format('pull-{0}.{1}', github.event.number, github.run_number) }}
81+
VERSION_PROPERTY: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/rel/')) && format('build.{0}', github.run_number) || format('pull-{0}.{1}', github.event.number, github.run_number) }}
7682

7783
# Steps represent a sequence of tasks that will be executed as part of the job
7884
steps:
@@ -228,7 +234,7 @@ jobs:
228234
winui: [0, 2, 3]
229235

230236
env:
231-
VERSION_PROPERTY: ${{ github.ref == 'refs/heads/main' && format('build.{0}', github.run_number) || format('pull-{0}.{1}', github.event.number, github.run_number) }}
237+
VERSION_PROPERTY: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/rel/')) && format('build.{0}', github.run_number) || format('pull-{0}.{1}', github.event.number, github.run_number) }}
232238

233239
steps:
234240
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
@@ -320,6 +326,103 @@ jobs:
320326
name: build-logs-winui${{ matrix.winui }}
321327
path: ./*.*log
322328

329+
sign:
330+
needs: [package]
331+
if: ${{ startsWith(github.ref, 'refs/heads/rel/') }}
332+
runs-on: windows-latest
333+
permissions:
334+
id-token: write # Required for requesting the JWT
335+
336+
strategy:
337+
fail-fast: false # prevent one matrix pipeline from being cancelled if one fails, we want them both to run to completion.
338+
matrix:
339+
winui: [2, 3]
340+
341+
steps:
342+
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
343+
uses: actions/setup-dotnet@v4
344+
with:
345+
dotnet-version: ${{ env.DOTNET_VERSION }}
346+
347+
- name: Download Package List
348+
uses: actions/download-artifact@v4
349+
with:
350+
name: nuget-list-${{ matrix.winui }}
351+
path: ./
352+
353+
- name: Download built packages for WinUI ${{ matrix.winui }}
354+
uses: actions/download-artifact@v4
355+
with:
356+
name: nuget-packages-winui${{ matrix.winui }}
357+
path: ./packages
358+
359+
- name: Install Signing Tool
360+
run: dotnet tool install --tool-path ./tools sign --version 0.9.1-beta.23356.1
361+
362+
- name: Sign Packages
363+
run: >
364+
./tools/sign code azure-key-vault
365+
**/*.nupkg
366+
--base-directory "${{ github.workspace }}/packages"
367+
--file-list "${{ github.workspace }}/SignClientFileList.txt"
368+
--timestamp-url "http://timestamp.digicert.com"
369+
--publisher-name ".NET Foundation"
370+
--description "Windows Community Toolkit Labs"
371+
--description-url "https://github.com/CommunityToolkit/Labs-Windows"
372+
--azure-key-vault-url "${{ secrets.SIGN_KEY_VAULT_URL }}"
373+
--azure-key-vault-client-id ${{ secrets.SIGN_CLIENT_ID }}
374+
--azure-key-vault-client-secret "${{ secrets.SIGN_CLIENT_SECRET }}"
375+
--azure-key-vault-tenant-id ${{ secrets.SIGN_TENANT_ID }}
376+
--azure-key-vault-certificate "${{ secrets.SIGN_CERTIFICATE }}"
377+
--verbosity Information
378+
379+
- name: Push Signed Packages
380+
run: |
381+
dotnet nuget add source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-MainLatest/nuget/v3/index.json `
382+
--name MainLatest `
383+
--username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }}
384+
dotnet nuget push "**/*.nupkg" --api-key dummy --source MainLatest --skip-duplicate
385+
386+
- name: Upload Signed Packages as Artifacts (for release)
387+
uses: actions/upload-artifact@v4
388+
if: ${{ env.IS_RELEASE == 'true' }}
389+
with:
390+
name: signed-nuget-packages-${{ matrix.winui }}
391+
if-no-files-found: error
392+
path: |
393+
${{ github.workspace }}/packages/**/*.nupkg
394+
395+
release:
396+
if: ${{ startsWith(github.ref, 'refs/heads/rel/') }}
397+
needs: [sign]
398+
environment: nuget-release-gate # This gates this job until manually approved
399+
runs-on: ubuntu-latest
400+
401+
strategy:
402+
fail-fast: false # prevent one matrix pipeline from being cancelled if one fails, we want them both to run to completion.
403+
matrix:
404+
winui: [2, 3]
405+
406+
steps:
407+
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
408+
uses: actions/setup-dotnet@v4
409+
with:
410+
dotnet-version: ${{ env.DOTNET_VERSION }}
411+
412+
- name: Download signed packages for WinUI ${{ matrix.winui }}
413+
uses: actions/download-artifact@v4
414+
with:
415+
name: signed-nuget-packages-${{ matrix.winui }}
416+
path: ./packages
417+
418+
- name: Push to NuGet.org
419+
run: >
420+
dotnet nuget push
421+
**/*.nupkg
422+
--source https://api.nuget.org/v3/index.json
423+
--api-key ${{ secrets.NUGET_PACKAGE_PUSH_TOKEN }}
424+
--skip-duplicate
425+
323426
wasm-linux:
324427
runs-on: ubuntu-latest
325428
env:

.github/workflows/weekly-merge.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: weekly-merge
2+
3+
on:
4+
schedule:
5+
# Runs every Wednesday at 08:00 UTC (midnight PST / 1:00 AM PDT)
6+
- cron: '0 8 * * 3'
7+
8+
# Allows manual triggering for convenience
9+
workflow_dispatch:
10+
11+
jobs:
12+
weekly-release:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
with:
21+
# Use a token with write permissions to push to the branch
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
fetch-depth: 0 # Fetch all history for merging
24+
25+
- name: Configure Git
26+
run: |
27+
git config user.name 'github-actions[bot]'
28+
git config user.email 'github-actions[bot]@users.noreply.github.com'
29+
30+
- name: Merge main into rel/weekly
31+
run: |
32+
git fetch origin
33+
git checkout rel/weekly
34+
git reset --hard origin/rel/weekly
35+
git merge --no-ff origin/main -m "Weekly merge of main into rel/weekly"
36+
git push origin rel/weekly

0 commit comments

Comments
 (0)