Skip to content

Version 0.0.5

Version 0.0.5 #11

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
env:
APP_NAME: ${{ github.event.repository.name }}
VERSION: ${{ github.ref_name }}
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
goos: linux
goarch: amd64
- os: ubuntu-latest
goos: linux
goarch: arm64
cc: aarch64-linux-gnu-gcc
cxx: aarch64-linux-gnu-g++
- os: macos-latest
goos: darwin
goarch: amd64
- os: macos-latest
goos: darwin
goarch: arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '>=1.22'
cache: true
- name: Install cross compiler (linux/arm64)
if: ${{ matrix.cc == 'aarch64-linux-gnu-gcc' }}
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Test
if: ${{ matrix.goos == 'linux' }}
run: go test ./...
- name: Build
shell: bash
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
CGO_ENABLED: 1
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
set -euxo pipefail
mkdir -p dist
OUT="dist/${APP_NAME}_${VERSION}_${GOOS}_${GOARCH}"
go build -trimpath -ldflags="-s -w -X main.version=${VERSION}" -o "$OUT" .
(cd dist && sha256sum "$(basename "$OUT")" > "$(basename "$OUT").sha256" || shasum -a 256 "$(basename "$OUT")" > "$(basename "$OUT").sha256")
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.goos }}-${{ matrix.goarch }}
path: dist/*
overwrite: true
release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: build
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: binaries-*
path: dist
merge-multiple: true
- name: Create/Update Release and Upload Assets
uses: softprops/action-gh-release@v2
with:
files: dist/*
prerelease: ${{ contains(github.ref_name, '-') }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}