Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Release

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'

permissions:
contents: write

jobs:
build-and-release:
name: Build and Release Binaries
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true

- name: Get version information
id: version
run: |
echo "version=$(make version)" >> $GITHUB_OUTPUT
echo "git_commit=$(make get-commit-hash)" >> $GITHUB_OUTPUT
echo "build_date=$(make get-build-date)" >> $GITHUB_OUTPUT

- name: Build binaries for multiple platforms
env:
VERSION: ${{ steps.version.outputs.version }}
GIT_COMMIT: ${{ steps.version.outputs.git_commit }}
BUILD_DATE: ${{ steps.version.outputs.build_date }}
run: |
LDFLAGS="-X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT} -X main.buildDate=${BUILD_DATE}"

# Linux amd64
GOOS=linux GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o roxie-linux-amd64 ./cmd

# Linux arm64
GOOS=linux GOARCH=arm64 go build -ldflags "${LDFLAGS}" -o roxie-linux-arm64 ./cmd

# macOS amd64
GOOS=darwin GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o roxie-darwin-amd64 ./cmd

# macOS arm64
GOOS=darwin GOARCH=arm64 go build -ldflags "${LDFLAGS}" -o roxie-darwin-arm64 ./cmd

# Generate checksums
sha256sum roxie-* > checksums.txt

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: Release ${{ steps.version.outputs.version }}
draft: false
prerelease: false
generate_release_notes: true
files: |
roxie-linux-amd64
roxie-linux-arm64
roxie-darwin-amd64
roxie-darwin-arm64
checksums.txt