Skip to content

tutorial: update all examples #12

tutorial: update all examples

tutorial: update all examples #12

Workflow file for this run

name: CI
on:
push:
branches: [master, main]
tags: ["v*"]
pull_request:
branches: [master, main]
jobs:
# ── 编译 + 静态检查 ──────────────────────────────────────────────────────
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.24"
- run: go mod tidy
- run: go build ./...
- run: go vet ./...
- run: go test ./... -count=1
# ── 多平台交叉编译(仅 tag 时生成 release 产物)─────────────────────────
release:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.24"
- name: Cross-compile
run: |
go mod tidy
mkdir -p dist
for GOOS in linux darwin; do
for GOARCH in amd64 arm64; do
echo "Building $GOOS/$GOARCH..."
GOOS=$GOOS GOARCH=$GOARCH go build -ldflags="-s -w" -o dist/kvlang-$GOOS-$GOARCH ./cmd/kvlang/
done
done
ls -lh dist/
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: dist/*
generate_release_notes: true