Skip to content

Release

Release #2

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Version tag (e.g. v1.2.3)"
required: false
default: "dev"
permissions:
contents: write
jobs:
build:
name: Build binaries
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: linux
arch: amd64
ext: ""
- os: linux
arch: arm64
ext: ""
- os: darwin
arch: amd64
ext: ""
- os: darwin
arch: arm64
ext: ""
- os: windows
arch: amd64
ext: ".exe"
- os: windows
arch: arm64
ext: ".exe"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
cache: true
- name: Resolve version
id: version
run: |
if [ "${{ github.event_name }}" = "push" ]; then
echo "version=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
elif [ -n "${{ inputs.tag }}" ]; then
echo "version=${{ inputs.tag }}" >> $GITHUB_OUTPUT
else
echo "version=dev-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
fi
- name: Build
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: "0"
run: |
mkdir -p dist
go build \
-ldflags="-s -w -X main.version=${{ steps.version.outputs.version }}" \
-o dist/wert-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }} .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: wert-${{ matrix.os }}-${{ matrix.arch }}
path: dist/wert-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }}
release:
name: Create release
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Generate checksums
working-directory: dist
run: sha256sum * > checksums.txt
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: |
dist/*
generate_release_notes: true
body: |
## Installation
Download the binary for your platform, make it executable, and move it to your PATH:
```bash
# macOS (Apple Silicon)
curl -Lo wert https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/wert-darwin-arm64
chmod +x wert && mv wert /usr/local/bin/wert
# macOS (Intel)
curl -Lo wert https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/wert-darwin-amd64
chmod +x wert && mv wert /usr/local/bin/wert
# Linux (amd64)
curl -Lo wert https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/wert-linux-amd64
chmod +x wert && mv wert /usr/local/bin/wert
```
Verify checksum with `checksums.txt`.