Skip to content

feat: add GitHub Actions workflow for building and releasing Go proje… #1

feat: add GitHub Actions workflow for building and releasing Go proje…

feat: add GitHub Actions workflow for building and releasing Go proje… #1

Workflow file for this run

name: Build and release Go Project
on:
push:
tags:
- "v*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
- name: Cross compile
run: |
mkdir -p bin
# Linux binaries
GOOS=linux GOARCH=amd64 go build -o bin/server-linux-amd64 ./cmd/server
GOOS=linux GOARCH=arm64 go build -o bin/server-linux-arm64 ./cmd/server
# macOS binaries
GOOS=darwin GOARCH=amd64 go build -o bin/server-darwin-amd64 ./cmd/server
GOOS=darwin GOARCH=arm64 go build -o bin/server-darwin-arm64 ./cmd/server
# Windows binaries
GOOS=windows GOARCH=amd64 go build -o bin/server-windows-amd64.exe ./cmd/server
- name: Release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ github.ref_name }}
body: |
This release includes:
- Linux binaries (amd64, arm64)
- macOS binaries (amd64, arm64)
- Windows binary (amd64)
files: |
bin/server-linux-amd64
bin/server-linux-arm64
bin/server-darwin-amd64
bin/server-darwin-arm64
bin/server-windows-amd64.exe