mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-03 08:03:38 +08:00
Add -extldflags '-static' to Windows build so libwinpthread-1.dll and other MinGW runtime DLLs are embedded in the binary.
174 lines
4.4 KiB
YAML
174 lines
4.4 KiB
YAML
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 == '' }}
|