Skip to content

Build and Release

Build and Release #17

Workflow file for this run

name: Build and Release
permissions:
contents: write
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64, arm64, arm, 386]
exclude:
- goos: darwin
goarch: arm
- goos: darwin
goarch: 386
fail-fast: false
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup Go
id: go
uses: actions/setup-go@v5
with:
go-version: ^1.24
- name: Read version
id: version
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV
- name: Build and zip
run: make build VERSION=$VERSION GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }}
- name: Read release note
id: read_release
shell: bash
run: |
r=$(cat RELEASE.md)
r="${r//'%'/'%25'}"
r="${r//$'\n'/'%0A'}"
r="${r//$'\r'/'%0D'}"
echo "RELEASE_BODY=$r" >> $GITHUB_OUTPUT
- name: Upload Release Assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/*
tag: ${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
overwrite: true
file_glob: true
prerelease: true
body: ${{ steps.read_release.outputs.RELEASE_BODY }}