From 49530a730cd8aa29bb0e3ff41558e2783b651964 Mon Sep 17 00:00:00 2001 From: Moritz Clasmeier Date: Wed, 18 Feb 2026 09:36:38 +0100 Subject: [PATCH] Enable GitHub releases based on git tags --- .github/workflows/release.yml | 70 +++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..5d8a6fc4 --- /dev/null +++ b/.github/workflows/release.yml @@ -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