-
Notifications
You must be signed in to change notification settings - Fork 249
173 lines (147 loc) · 4.42 KB
/
release.yml
File metadata and controls
173 lines (147 loc) · 4.42 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
name: Release
on:
workflow_dispatch:
inputs:
version:
description: "Release version (e.g. v0.0.2)"
required: true
type: string
release_notes:
description: "Release notes (optional — auto-generated from commits if empty)"
required: false
type: string
replace:
description: "Replace existing release if it exists"
required: false
type: boolean
default: false
permissions:
contents: write
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.26"
- uses: golangci/golangci-lint-action@v7
with:
version: v2.10
args: --timeout=5m
build-unix:
needs: [lint]
strategy:
matrix:
include:
- os: ubuntu-latest
goos: linux
goarch: amd64
- os: ubuntu-24.04-arm
goos: linux
goarch: arm64
- os: macos-14
goos: darwin
goarch: arm64
- os: macos-15-intel
goos: darwin
goarch: amd64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.26"
- name: Run tests
run: go test ./...
- name: Build binary
env:
VERSION: ${{ inputs.version }}
run: |
# Strip leading 'v' — version var should be bare semver (e.g. 0.4.0)
CLEAN_VERSION="${VERSION#v}"
CGO_ENABLED=1 go build \
-ldflags "-X main.version=$CLEAN_VERSION" \
-o codebase-memory-mcp \
./cmd/codebase-memory-mcp/
- name: Smoke test
run: bash scripts/smoke-test.sh ./codebase-memory-mcp
- name: Create archive
run: tar -czf codebase-memory-mcp-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz codebase-memory-mcp
- uses: actions/upload-artifact@v4
with:
name: codebase-memory-mcp-${{ matrix.goos }}-${{ matrix.goarch }}
path: "*.tar.gz"
build-windows:
needs: [lint]
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.26"
- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
path-type: inherit
install: mingw-w64-ucrt-x86_64-gcc
- name: Run tests
shell: msys2 {0}
run: |
which go
go version
go test ./...
- name: Build binary
shell: msys2 {0}
env:
VERSION: ${{ inputs.version }}
run: |
# Strip leading 'v' — version var should be bare semver (e.g. 0.4.0)
CLEAN_VERSION="${VERSION#v}"
CGO_ENABLED=1 CC=gcc go build \
-ldflags "-X main.version=$CLEAN_VERSION -extldflags '-static'" \
-o codebase-memory-mcp.exe \
./cmd/codebase-memory-mcp/
- name: Smoke test
shell: msys2 {0}
run: bash scripts/smoke-test.sh ./codebase-memory-mcp.exe
- name: Create archive
shell: pwsh
run: Compress-Archive -Path codebase-memory-mcp.exe -DestinationPath codebase-memory-mcp-windows-amd64.zip
- uses: actions/upload-artifact@v4
with:
name: codebase-memory-mcp-windows-amd64
path: "*.zip"
release:
needs: [build-unix, build-windows]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Generate checksums
run: sha256sum *.tar.gz *.zip > checksums.txt
- name: Delete existing release
if: ${{ inputs.replace }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ inputs.version }}
run: gh release delete "$VERSION" --yes --cleanup-tag || true
- name: Create tag
env:
VERSION: ${{ inputs.version }}
run: |
git tag -f "$VERSION"
git push origin "$VERSION" --force
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.version }}
files: |
*.tar.gz
*.zip
checksums.txt
body: ${{ inputs.release_notes || '' }}
generate_release_notes: ${{ inputs.release_notes == '' }}