Skip to content

support subpackages

support subpackages #7

Workflow file for this run

name: Build
on:
push:
branches:
- main
- dev
workflow_dispatch: # 允许手动触发 workflow
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
goos: [windows, linux, darwin]
goarch: [amd64, arm64]
exclude:
- goos: windows
goarch: arm64
- goos: darwin
goarch: amd64
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.24'
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOARM: 7
CGO_ENABLED: 0 # 禁用 CGO 以进行静态链接
run: |
output_name="godoc-mcp-server-${GOOS}-${GOARCH}"
if [ "${GOOS}" = "windows" ]; then
output_name="${output_name}.exe"
fi
go build -ldflags="-s -w" -o "${output_name}" ./cmd/godoc-mcp-server
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: godoc-mcp-server-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goos == 'windows' && '.exe' || '' }}
tag: latest
overwrite: true
file_glob: true
release_name: "Latest Release"
body: "Automatically built binaries for different platforms."