-
Notifications
You must be signed in to change notification settings - Fork 664
227 lines (201 loc) · 6.22 KB
/
Copy pathci.yml
File metadata and controls
227 lines (201 loc) · 6.22 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
name: CI
on:
push:
branches:
- main
- 'fix/*'
- 'feature/*'
- 'poc/*'
- 'support/*'
- 'next/*'
paths:
- '**'
- '!docs/**'
pull_request:
branches:
- main
- 'support/*'
- 'next/*'
paths:
- '**'
- '!docs/**'
merge_group:
types: [ checks_requested ]
repository_dispatch:
types: [ ci-release ]
env:
DOTNET_ROLL_FORWARD: "Major"
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: 1
TESTINGPLATFORM_TELEMETRY_OPTOUT: 1
ENABLED_DIAGNOSTICS: ${{ vars.ENABLED_DIAGNOSTICS }}
permissions:
contents: read
jobs:
prepare:
name: Prepare
permissions:
contents: read
uses: ./.github/workflows/_prepare.yml
publish_flags:
name: Publish Flags
runs-on: ubuntu-24.04
permissions:
contents: read
outputs:
can_publish: ${{ steps.flags.outputs.can_publish }}
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- name: Resolve publish flag
id: flags
shell: bash
run: echo "can_publish=${{ github.repository == 'GitTools/GitVersion' && github.ref_name == 'main' }}" >> "$GITHUB_OUTPUT"
build:
name: Build & Package
needs: [ prepare ]
permissions:
contents: read
uses: ./.github/workflows/_build.yml
unit_test:
name: Test
needs: [ prepare, publish_flags ]
permissions:
contents: read
id-token: write
uses: ./.github/workflows/_unit_tests.yml
with:
dotnet_versions: ${{ needs.prepare.outputs.dotnet_versions }}
publish_coverage: ${{ fromJson(needs.publish_flags.outputs.can_publish) }}
secrets: inherit
artifacts_windows_test:
name: Artifacts Windows
needs: [ build ]
permissions:
contents: read
uses: ./.github/workflows/_artifacts_windows.yml
artifacts_linux_test:
needs: [ prepare, build ]
name: Artifacts Linux (${{ matrix.arch }})
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-24.04
- arch: arm64
runner: ubuntu-24.04-arm
uses: ./.github/workflows/_artifacts_linux.yml
with:
runner: ${{ matrix.runner }}
arch: ${{ matrix.arch }}
docker_distros: ${{ needs.prepare.outputs.docker_distros }}
dotnet_versions: ${{ needs.prepare.outputs.dotnet_versions }}
docker_linux_images:
needs: [ prepare, build, publish_flags ]
name: Docker Images (${{ matrix.arch }})
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-24.04
- arch: arm64
runner: ubuntu-24.04-arm
uses: ./.github/workflows/_docker.yml
with:
runner: ${{ matrix.runner }}
arch: ${{ matrix.arch }}
docker_distros: ${{ needs.prepare.outputs.docker_distros }}
dotnet_versions: ${{ needs.prepare.outputs.dotnet_versions }}
publish_images: ${{ fromJson(needs.publish_flags.outputs.can_publish) }}
secrets: inherit
docker_linux_manifests:
needs: [ prepare, docker_linux_images, publish_flags ]
name: Docker Manifests
permissions:
contents: read
packages: write
uses: ./.github/workflows/_docker_manifests.yml
with:
docker_distros: ${{ needs.prepare.outputs.docker_distros }}
dotnet_versions: ${{ needs.prepare.outputs.dotnet_versions }}
publish_manifests: ${{ fromJson(needs.publish_flags.outputs.can_publish) }}
secrets: inherit
publish:
name: Publish
needs: [ artifacts_windows_test, artifacts_linux_test, publish_flags ]
permissions:
contents: read
id-token: write
packages: write
uses: ./.github/workflows/_publish.yml
with:
publish_packages: ${{ fromJson(needs.publish_flags.outputs.can_publish) }}
secrets: inherit
release:
name: Release
needs: [ publish, docker_linux_manifests ]
runs-on: windows-2025-vs2026
permissions:
contents: write
packages: write
id-token: write
attestations: write
issues: write
env:
GITHUB_TOKEN: ${{ github.token }}
CAN_PUBLISH: ${{ github.event_name == 'repository_dispatch' }}
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- name: Restore State
uses: ./.github/actions/cache-restore
- name: Restore Artifacts
uses: ./.github/actions/artifacts-restore
- name: Attestation
if: env.CAN_PUBLISH == 'true'
uses: ./.github/actions/artifacts-attest
- name: Load DockerHub credentials
id: dockerhub-creds
if: env.CAN_PUBLISH == 'true'
uses: gittools/cicd/dockerhub-creds@824c3d773fb5d1b00c26b474ae88b7ce9ae555ee # v5
with:
op_service_account_token: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
- name: DockerHub Publish Readme
if: env.CAN_PUBLISH == 'true'
shell: pwsh
run: dotnet run/docker.dll --target=DockerHubReadmePublish
env:
DOCKER_USERNAME: ${{ steps.dockerhub-creds.outputs.docker_username }}
DOCKER_PASSWORD: ${{ steps.dockerhub-creds.outputs.docker_password }}
- name: '[Release]'
shell: pwsh
run: dotnet run/release.dll --target=PublishRelease
- name: '[Publish Release]'
if: github.event_name == 'repository_dispatch'
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0.1
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
event-type: publish-release
client-payload: |
{
"ref": "${{ github.ref }}",
"sha": "${{ github.sha }}",
"tag": "${{ github.event.client_payload.tag }}"
}