-
Notifications
You must be signed in to change notification settings - Fork 4
339 lines (294 loc) · 11.8 KB
/
release.yml
File metadata and controls
339 lines (294 loc) · 11.8 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
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/tracker/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@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: "lts/*"
- 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@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: "22"
- 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/...
release:
name: Tag & Release
needs:
- lint
- test-unit
- test-integration-jira
- test-integration-github
- test-e2e-github
- test-integration-claude
- test-integration-copilot
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@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7.0.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"