Repository navigation
185 lines (158 loc) · 5.73 KB
/
Copy pathupdate-dotnet-sdks.yml
File metadata and controls
185 lines (158 loc) · 5.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: update-dotnet-sdks
on:
repository_dispatch:
types: [ dotnet_release ]
schedule:
- cron: '00 19 * * TUE'
workflow_call:
inputs:
branch:
description: 'The branch to run the SDK updates for.'
required: true
type: string
repository:
description: 'An optional single repository to update.'
required: false
type: string
workflow_dispatch:
inputs:
branch:
description: 'The branch to run the SDK updates for.'
required: false
type: choice
options:
- 'main'
- 'dotnet-vnext'
- 'dotnet-nightly'
default: 'main'
repository:
description: 'An optional single repository to update.'
required: false
type: string
default: ''
permissions: {}
jobs:
get-repos:
runs-on: ubuntu-26.04
timeout-minutes: 90
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
environment:
name: update-dotnet-sdks
deployment: false
outputs:
updates: ${{ steps.get-repos.outputs.updates }}
permissions:
contents: read
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
filter: 'tree:0'
persist-credentials: false
show-progress: false
- name: Get GitHub token
id: get-github-token
uses: ./actions/get-github-token
with:
profile-name: update-dotnet-sdks
- name: Get repositories to update
uses: ./actions/get-sdk-repos
id: get-repos
with:
branch: ${{ (github.event.client_payload && github.event.client_payload.branch) || inputs.branch || '' }}
github-token: ${{ steps.get-github-token.outputs.token }}
nightly-channel: ${{ vars.DOTNET_NIGHTLY_CHANNEL }}
prerelease-label: ${{ vars.DOTNET_PRERELEASE_LABEL }}
repository: ${{ inputs.repository || '' }}
- name: Setup .NET SDK
if: github.event_name == 'repository_dispatch' && github.event.action == 'dotnet_release'
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
- name: Restore .NET tools
if: github.event_name == 'repository_dispatch' && github.event.action == 'dotnet_release'
shell: pwsh
run: dotnet tool restore
- name: Wait for NuGet packages to be published
if: github.event_name == 'repository_dispatch' && github.event.action == 'dotnet_release'
shell: pwsh
env:
PACKAGES: ${{ github.event.client_payload.packages }}
PUBLISH_TIMEOUT: '01:30:00'
run: |
$packages = ${env:PACKAGES} -Split ','
dotnet wait-for-package $packages --timeout ${env:PUBLISH_TIMEOUT}
if ($LASTEXITCODE -ne 0) {
Write-Output "::warning::NuGet packages were not published within the timeout period."
}
update-sdk:
name: 'update-${{ matrix.repo }}'
needs: [ get-repos ]
if: needs.get-repos.outputs.updates != '[]'
uses: martincostello/update-dotnet-sdk/.github/workflows/update-dotnet-sdk.yml@abd8862698d4748a3b545405b4ea3f1cdc66b2ca # v6.1.3
concurrency:
group: 'update-sdk-${{ matrix.repo }}'
cancel-in-progress: false
strategy:
fail-fast: false
max-parallel: 3
matrix:
include: ${{ fromJSON(needs.get-repos.outputs.updates) }}
with:
channel: ${{ matrix.channel }}
dotnet-roll-forward: 'Major'
exclude-nuget-packages: ${{ matrix.exclude-nuget-packages }}
include-nuget-packages: ${{ matrix.include-nuget-packages }}
labels: ${{ matrix.labels }}
nuget-packages-prerelease-label: ${{ matrix.dotnet-prerelease-label }}
quality: ${{ matrix.quality }}
ref: ${{ matrix.ref }}
repo: ${{ matrix.repo }}
sdk-prerelease-label: ${{ matrix.dotnet-prerelease-label }}
update-nuget-packages: ${{ matrix.update-nuget-packages }}
user-email: ${{ vars.GIT_COMMIT_USER_EMAIL }}
user-name: ${{ vars.GIT_COMMIT_USER_NAME }}
secrets:
repo-token: ${{ secrets.COSTELLOBOT_TOKEN }}
update-sdk-external:
runs-on: ubuntu-26.04
timeout-minutes: 5
if: inputs.repository == ''
concurrency:
group: '${{ github.workflow }}-external'
cancel-in-progress: false
environment:
name: external
deployment: false
permissions:
id-token: write
steps:
- name: Get GitHub token
id: get-github-token
uses: martincostello/github-automation/actions/get-github-token@279f5d3cc244dfdd9bb1197d2ab6996c37cb4486 # get-github-token/v4.3.3
with:
profile-name: external
- name: Update .NET SDKs
shell: pwsh
env:
BRANCH_NAME: ${{ (github.event.client_payload && github.event.client_payload.branch) || inputs.branch || 'main' }}
GH_TOKEN: ${{ steps.get-github-token.outputs.token }}
run: |
$branch = $env:BRANCH_NAME
$repos = @(
"App-vNext/Polly",
"aspnet-contrib/AspNet.Security.OAuth.Providers",
"aspnet-contrib/AspNet.Security.OpenId.Providers",
"domaindrivendev/Swashbuckle.AspNetCore"
)
foreach ($repo in $repos) {
gh api "repos/${repo}/branches/${branch}" 2> $null | Out-Null
if ($LASTEXITCODE -ne 0) {
Write-Output "::Debug::Skipping ${repo} as the ${branch} branch does not exist."
continue
}
gh workflow run "update-dotnet-sdk.yml" --ref $branch --repo $repo
Start-Sleep -Seconds 10 # Wait 10 seconds to prevent issues with GitHub secondary rate limits
}
exit 0