-
Notifications
You must be signed in to change notification settings - Fork 4
510 lines (443 loc) · 17.9 KB
/
release.yml
File metadata and controls
510 lines (443 loc) · 17.9 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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
name: Release
on:
workflow_dispatch:
inputs:
version:
description: "Release version (semver, e.g. 1.0.0 or 1.0.0-rc.1 — no 'v' prefix)"
required: true
type: string
dry_run:
description: "Dry run — run all steps but skip tag creation and release publish"
required: false
type: boolean
default: false
permissions:
contents: write
# Only one release pipeline at a time.
concurrency:
group: release
cancel-in-progress: false
jobs:
validate:
name: Validate inputs
runs-on: ubuntu-latest
steps:
- name: Validate version format
run: |
VERSION='${{ inputs.version }}'
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+(\.[a-zA-Z0-9]+)*)?$ ]]; then
echo "::error::Invalid version format: '${VERSION}'. Expected semver (e.g. 1.0.0 or 1.0.0-rc.1)"
exit 1
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Check tag does not already exist
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Verify tag is new
run: |
TAG='${{ inputs.version }}'
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "::error::Tag ${TAG} already exists. Delete it first or choose a different version."
exit 1
fi
echo "✓ Tag ${TAG} is available"
- name: Verify CHANGELOG.md contains release version
run: |
VERSION='${{ inputs.version }}'
if ! grep -qP "^## \[${VERSION}\]" CHANGELOG.md; then
echo "::error::CHANGELOG.md has no entry for version ${VERSION}. Add a '## [${VERSION}] - YYYY-MM-DD' section before releasing."
exit 1
fi
echo "✓ CHANGELOG.md contains [${VERSION}]"
lint:
name: Lint
needs: [validate]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
- name: Run linter
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
version: latest
test-unit:
name: Unit tests
needs: [validate]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
- name: Run unit tests
run: go test -race -count=1 ./...
test-integration-jira:
name: "Integration: Jira"
needs: [lint, test-unit]
runs-on: ubuntu-latest
env:
SORTIE_JIRA_TEST: "1"
SORTIE_JIRA_ENDPOINT: ${{ secrets.SORTIE_JIRA_ENDPOINT }}
SORTIE_JIRA_API_KEY: ${{ secrets.SORTIE_JIRA_API_KEY }}
SORTIE_JIRA_PROJECT: ${{ secrets.SORTIE_JIRA_PROJECT }}
steps:
- name: Verify Jira secrets are configured
run: |
missing=()
[ -z "$SORTIE_JIRA_ENDPOINT" ] && missing+=("SORTIE_JIRA_ENDPOINT")
[ -z "$SORTIE_JIRA_API_KEY" ] && missing+=("SORTIE_JIRA_API_KEY")
[ -z "$SORTIE_JIRA_PROJECT" ] && missing+=("SORTIE_JIRA_PROJECT")
if [ ${#missing[@]} -ne 0 ]; then
echo "::error::Missing required secrets: ${missing[*]}"
echo "Configure these in Settings → Secrets and variables → Actions"
exit 1
fi
echo "✓ All Jira secrets are present"
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
- name: Run integration tests
run: go test -race -count=1 -v -run 'Integration' ./internal/tracker/jira/...
test-integration-github:
name: "Integration: GitHub"
needs: [lint, test-unit]
runs-on: ubuntu-latest
env:
SORTIE_GITHUB_TEST: "1"
SORTIE_GITHUB_TOKEN: ${{ secrets.SORTIE_GITHUB_TOKEN }}
SORTIE_GITHUB_PROJECT: sortie-ai/sortie-test
steps:
- name: Verify GitHub secrets are configured
run: |
missing=()
[ -z "$SORTIE_GITHUB_TOKEN" ] && missing+=("SORTIE_GITHUB_TOKEN")
if [ ${#missing[@]} -ne 0 ]; then
echo "::error::Missing required secrets: ${missing[*]}"
echo "Configure these in Settings → Secrets and variables → Actions"
exit 1
fi
echo "✓ All GitHub secrets are present"
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
- name: Run integration tests
run: go test -race -count=1 -v -run 'Integration' ./internal/scm/github/...
test-e2e-github:
name: "E2E: GitHub orchestrator"
needs: [lint, test-unit]
runs-on: ubuntu-latest
env:
SORTIE_GITHUB_E2E: "1"
SORTIE_GITHUB_TOKEN: ${{ secrets.SORTIE_GITHUB_TOKEN }}
SORTIE_GITHUB_PROJECT: sortie-ai/sortie-test
steps:
- name: Verify GitHub token secret is configured
run: |
missing=()
[ -z "$SORTIE_GITHUB_TOKEN" ] && missing+=("SORTIE_GITHUB_TOKEN")
if [ ${#missing[@]} -ne 0 ]; then
echo "::error::Missing required secrets: ${missing[*]}"
echo "Configure SORTIE_GITHUB_TOKEN in Settings → Secrets and variables → Actions"
exit 1
fi
echo "✓ GitHub E2E token secret is present"
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
- name: Run E2E tests
run: go test -race -count=1 -v -timeout 120s -run 'TestGitHubIntegration' ./internal/orchestrator/...
test-integration-claude:
name: "Integration: Claude Code"
needs: [lint, test-unit]
runs-on: ubuntu-latest
env:
SORTIE_CLAUDE_TEST: "1"
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
steps:
- name: Verify Claude Code secrets are configured
run: |
missing=()
[ -z "$ANTHROPIC_API_KEY" ] && missing+=("ANTHROPIC_API_KEY")
if [ ${#missing[@]} -ne 0 ]; then
echo "::error::Missing required secrets: ${missing[*]}"
echo "Configure these in Settings → Secrets and variables → Actions"
exit 1
fi
echo "✓ All Claude Code secrets are present"
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "24"
- name: Install Claude Code CLI
run: npm install -g @anthropic-ai/claude-code
- name: Run integration tests
run: go test -race -count=1 -v -timeout 300s -run 'Integration' ./internal/agent/claude/...
test-integration-copilot:
name: "Integration: GitHub Copilot CLI"
needs: [lint, test-unit]
runs-on: ubuntu-latest
env:
SORTIE_COPILOT_TEST: "1"
GH_TOKEN: ${{ secrets.SORTIE_COPILOT_TOKEN }}
steps:
- name: Verify Copilot CLI secrets are configured
run: |
missing=()
[ -z "$GH_TOKEN" ] && missing+=("SORTIE_COPILOT_TOKEN")
if [ ${#missing[@]} -ne 0 ]; then
echo "::error::Missing required secrets: ${missing[*]}"
echo "Configure these in Settings → Secrets and variables → Actions"
exit 1
fi
echo "✓ All Copilot CLI secrets are present"
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "24"
- name: Install GitHub Copilot CLI
run: npm install -g @github/copilot
- name: Run integration tests
run: go test -race -count=1 -v -timeout 300s -run 'Integration' ./internal/agent/copilot/...
test-integration-codex:
name: "Integration: OpenAI Codex"
needs: [lint, test-unit]
runs-on: ubuntu-latest
env:
SORTIE_CODEX_TEST: "1"
CODEX_API_KEY: ${{ secrets.CODEX_API_KEY }}
steps:
- name: Verify Codex secrets are configured
run: |
missing=()
[ -z "$CODEX_API_KEY" ] && missing+=("CODEX_API_KEY")
if [ ${#missing[@]} -ne 0 ]; then
echo "::error::Missing required secrets: ${missing[*]}"
echo "Configure these in Settings → Secrets and variables → Actions"
exit 1
fi
echo "✓ All Codex secrets are present"
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "24"
- name: Install OpenAI Codex CLI
run: npm install -g @openai/codex
- name: Run integration tests
run: go test -race -count=1 -v -timeout 300s -run 'Integration' ./internal/agent/codex/...
test-integration-opencode:
name: "Integration: OpenCode"
needs: [lint, test-unit]
runs-on: ubuntu-latest
env:
SORTIE_OPENCODE_TEST: "1"
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
steps:
- name: Verify OpenCode secrets are configured
run: |
missing=()
[ -z "$ANTHROPIC_API_KEY" ] && missing+=("ANTHROPIC_API_KEY")
if [ ${#missing[@]} -ne 0 ]; then
echo "::error::Missing required secrets: ${missing[*]}"
echo "Configure these in Settings → Secrets and variables → Actions"
exit 1
fi
echo "✓ All OpenCode secrets are present"
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "24"
- name: Install OpenCode CLI
run: npm install -g opencode-ai
- name: Run integration tests
run: go test -race -count=1 -v -timeout 300s -run 'Integration' ./internal/agent/opencode/...
release:
name: Tag & Release
needs:
- lint
- test-unit
- test-integration-jira
- test-integration-github
- test-e2e-github
- test-integration-claude
- test-integration-copilot
- test-integration-codex
- test-integration-opencode
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
- name: Install Syft
uses: anchore/sbom-action/download-syft@e22c389904149dbc22b58101806040fa8d37a610 # v0.24.0
- name: Create and push tag
if: ${{ !inputs.dry_run }}
run: |
TAG='${{ inputs.version }}'
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "$TAG" -m "Release ${TAG}"
git push origin "$TAG"
echo "### Tagged \`${TAG}\`" >> "$GITHUB_STEP_SUMMARY"
- name: Create local tag (dry run)
if: ${{ inputs.dry_run }}
run: |
TAG='${{ inputs.version }}'
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "$TAG" -m "Dry run ${TAG}"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@e24998b8b67b290c2fa8b7c14fcfa7de2c5c9b8c # v7.1.0
with:
distribution: goreleaser
version: "~> v2"
args: release ${{ inputs.dry_run && '--skip=publish --skip=announce' || '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
- name: Release summary
if: ${{ !inputs.dry_run }}
run: |
echo "### Release ${{ inputs.version }} published" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "**Artifacts:**" >> "$GITHUB_STEP_SUMMARY"
echo "- \`sortie_${{ inputs.version }}_linux_amd64.tar.gz\`" >> "$GITHUB_STEP_SUMMARY"
echo "- \`sortie_${{ inputs.version }}_linux_arm64.tar.gz\`" >> "$GITHUB_STEP_SUMMARY"
echo "- \`sortie_${{ inputs.version }}_darwin_amd64.tar.gz\`" >> "$GITHUB_STEP_SUMMARY"
echo "- \`sortie_${{ inputs.version }}_darwin_arm64.tar.gz\`" >> "$GITHUB_STEP_SUMMARY"
echo "- \`sortie_${{ inputs.version }}_windows_amd64.zip\`" >> "$GITHUB_STEP_SUMMARY"
echo "- \`sortie_${{ inputs.version }}_windows_arm64.zip\`" >> "$GITHUB_STEP_SUMMARY"
echo "- \`checksums.txt\`" >> "$GITHUB_STEP_SUMMARY"
echo "- SBOM manifests (\`*.sbom.json\`)" >> "$GITHUB_STEP_SUMMARY"
- name: Dry run summary
if: ${{ inputs.dry_run }}
run: |
echo "### Dry run complete for ${{ inputs.version }}" >> "$GITHUB_STEP_SUMMARY"
echo "No tag was created and no release was published." >> "$GITHUB_STEP_SUMMARY"
docker:
name: Docker image
needs: [release]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
attestations: write
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Determine pre-release
id: prerelease
run: |
VERSION='${{ inputs.version }}'
if [[ "$VERSION" == *-* ]]; then
echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
fi
- name: Set build date
run: echo "BUILD_DATE=$(date -u +%Y-%m-%d)" >> "$GITHUB_ENV"
- name: Set up QEMU
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Log in to GHCR
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}},value=${{ inputs.version }}
type=semver,pattern={{major}}.{{minor}},value=${{ inputs.version }}
type=semver,pattern={{major}},value=${{ inputs.version }},enable=${{ steps.prerelease.outputs.is_prerelease == 'false' }}
- name: Build and push
id: build
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ !inputs.dry_run }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
build-args: |
VERSION=${{ inputs.version }}
REVISION=${{ github.sha }}
BUILD_DATE=${{ env.BUILD_DATE }}
provenance: mode=max
sbom: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Generate artifact attestation
if: ${{ !inputs.dry_run }}
uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1.0
with:
subject-name: ghcr.io/${{ github.repository }}
subject-digest: ${{ steps.build.outputs.digest }}
push-to-registry: true
- name: Docker summary
run: |
echo "### Docker image" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
if [ "${{ inputs.dry_run }}" == "true" ]; then
echo "Multi-platform image built but **not pushed** (dry run)." >> "$GITHUB_STEP_SUMMARY"
else
echo "Published to \`ghcr.io/${{ github.repository }}\`:" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
echo '${{ steps.meta.outputs.tags }}' >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "**Platforms:** linux/amd64, linux/arm64" >> "$GITHUB_STEP_SUMMARY"
echo "**Digest:** \`${{ steps.build.outputs.digest }}\`" >> "$GITHUB_STEP_SUMMARY"
fi