Loading files
8fa3436b2This file is pinned to the selected release. Download the original to open it in your design tool.
name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
tag:
description: "Tag name (e.g. v1.2.0). Created if missing."
required: true
permissions:
contents: write
jobs:
build:
name: build ${{ matrix.label }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- label: macos-arm64
goos: darwin
goarch: arm64
bin: fragua
archive: tar.gz
- label: macos-x64
goos: darwin
goarch: amd64
bin: fragua
archive: tar.gz
- label: linux-x64
goos: linux
goarch: amd64
bin: fragua
archive: tar.gz
- label: windows-x64
goos: windows
goarch: amd64
bin: fragua.exe
archive: zip
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v5
with:
go-version: "1.25.x"
- name: Build
env:
CGO_ENABLED: "0"
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: go build -trimpath -ldflags="-s -w" -o "${{ matrix.bin }}" ./cmd/fragua
- name: Stage artifacts
shell: bash
run: |
set -eu
tag="${GITHUB_REF_NAME:-${{ github.event.inputs.tag }}}"
stage="fragua-${tag}-${{ matrix.label }}"
mkdir "$stage"
cp "${{ matrix.bin }}" README.md LICENSE "$stage/"
if [ "${{ matrix.archive }}" = "zip" ]; then
zip -r "${stage}.zip" "$stage"
sha256sum "${stage}.zip" > "${stage}.zip.sha256"
else
tar -czf "${stage}.tar.gz" "$stage"
sha256sum "${stage}.tar.gz" > "${stage}.tar.gz.sha256"
fi
ls -la fragua-"${tag}"-${{ matrix.label }}.*
- uses: actions/upload-artifact@v5
with:
name: fragua-${{ matrix.label }}
path: |
fragua-*-${{ matrix.label }}.tar.gz
fragua-*-${{ matrix.label }}.tar.gz.sha256
fragua-*-${{ matrix.label }}.zip
fragua-*-${{ matrix.label }}.zip.sha256
if-no-files-found: error
release:
name: publish release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/download-artifact@v5
with:
path: dist
merge-multiple: true
- name: List artifacts
run: ls -la dist
- name: Resolve tag
id: tag
run: |
if [ -n "${{ github.event.inputs.tag }}" ]; then
echo "name=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "name=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
fi
- name: Create / update release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.name }}
name: ${{ steps.tag.outputs.name }}
generate_release_notes: true
fail_on_unmatched_files: true
files: |
dist/fragua-*.tar.gz
dist/fragua-*.tar.gz.sha256
dist/fragua-*.zip
dist/fragua-*.zip.sha256