name: release on: push: tags: - 'v*' permissions: contents: write jobs: release: name: Build and publish release runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Go uses: actions/setup-go@v5 with: go-version-file: go.mod - name: Build binaries env: CGO_ENABLED: "0" TAG: ${{ github.ref_name }} run: | mkdir -p dist for target in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64 windows/arm64; do os=${target%/*} arch=${target#*/} ext="" [ "$os" = "windows" ] && ext=".exe" GOOS=$os GOARCH=$arch go build -trimpath \ -ldflags="-s -w -X main.version=${TAG}" \ -o "dist/glint-${TAG}-${os}-${arch}${ext}" \ ./cmd/glint/... echo "built: glint-${TAG}-${os}-${arch}${ext}" done - name: Create release and upload assets env: GH_TOKEN: ${{ github.token }} TAG: ${{ github.ref_name }} run: | gh release create "$TAG" dist/* \ --repo "$GITHUB_REPOSITORY" \ --title "$TAG" \ --notes "See [CHANGELOG.md](https://github.com/${GITHUB_REPOSITORY}/blob/${TAG}/CHANGELOG.md) for details."