You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
2.4 KiB
83 lines
2.4 KiB
# This workflow will build a golang project |
|
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go |
|
# |
|
# Release Process: |
|
# 1. Update the version in the pkg/version/version file (e.g. v1.2.3) |
|
# 2. Create and push a tag matching the version: |
|
# git tag v1.2.3 |
|
# git push origin v1.2.3 |
|
# 3. The workflow will automatically: |
|
# - Build binaries for multiple platforms (Linux, macOS, Windows) |
|
# - Create a GitHub release with the binaries |
|
# - Generate release notes |
|
|
|
name: Go |
|
|
|
on: |
|
push: |
|
tags: |
|
- "v[0-9]+.[0-9]+.[0-9]+" |
|
|
|
jobs: |
|
build: |
|
runs-on: ubuntu-latest |
|
steps: |
|
- uses: actions/checkout@v4 |
|
|
|
- name: Set up Go |
|
uses: actions/setup-go@v4 |
|
with: |
|
go-version: "1.25" |
|
|
|
- name: Set CGO off |
|
run: echo "CGO_ENABLED=0" >> $GITHUB_ENV |
|
|
|
- name: Build |
|
run: go build -v ./... |
|
|
|
- name: Test |
|
run: go test -v $(go list ./... | xargs -n1 sh -c 'ls $0/*_test.go 1>/dev/null 2>&1 && echo $0' | grep .) |
|
release: |
|
needs: build |
|
runs-on: ubuntu-latest |
|
permissions: |
|
contents: write |
|
packages: write |
|
|
|
steps: |
|
- uses: actions/checkout@v4 |
|
|
|
- name: Set up Go |
|
uses: actions/setup-go@v4 |
|
with: |
|
go-version: '1.25' |
|
|
|
- name: Build Release Binaries |
|
if: startsWith(github.ref, 'refs/tags/v') |
|
run: | |
|
# Extract version from tag (e.g., v1.2.3 -> 1.2.3) |
|
VERSION=${GITHUB_REF#refs/tags/v} |
|
echo "Building release binaries for version $VERSION" |
|
|
|
# Create directory for binaries |
|
mkdir -p release-binaries |
|
|
|
# Build for different platforms |
|
GOEXPERIMENT=greenteagc,jsonv2 GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-s -w" -o release-binaries/orly-${VERSION}-linux-amd64 . |
|
|
|
# Note: Only building orly binary as requested |
|
# Other cmd utilities (aggregator, benchmark, convert, policytest, stresstest) are development tools |
|
|
|
# Create checksums |
|
cd release-binaries |
|
sha256sum * > SHA256SUMS.txt |
|
cd .. |
|
|
|
- name: Create GitHub Release |
|
if: startsWith(github.ref, 'refs/tags/v') |
|
uses: softprops/action-gh-release@v1 |
|
with: |
|
files: release-binaries/* |
|
draft: false |
|
prerelease: false |
|
generate_release_notes: true
|
|
|