Files
streamed-tui/.github/workflows/release.yml
2025-11-23 03:57:32 -05:00

117 lines
2.7 KiB
YAML

name: Build release binaries
on:
push:
tags:
- "v*"
permissions:
contents: write
env:
BINARY_NAME: streamed-tui
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
# Build raw binary
- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
mkdir -p dist
out="streamed-tui_${{ matrix.goos }}_${{ matrix.goarch }}"
go build -o "dist/${out}" .
# Upload binary as an artifact
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: bin_${{ matrix.goos }}_${{ matrix.goarch }}
path: dist/streamed-tui_${{ matrix.goos }}_${{ matrix.goarch }}
source:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Make source tarball
run: |
mkdir -p dist
tag="${GITHUB_REF_NAME}"
tar -czf "dist/${{ env.BINARY_NAME }}_${tag}_source.tar.gz" .
- name: Upload source artifact
uses: actions/upload-artifact@v4
with:
name: source
path: dist/*source.tar.gz
publish:
runs-on: ubuntu-latest
needs: [build, source]
permissions:
contents: write
steps:
# ❌ Delete all previous artifacts so old tar.gz does not pollute dist/
- name: Delete old workflow artifacts
uses: geekyeggo/delete-artifact@v4
with:
name: "*"
# Clean runner dist directory just in case
- name: Prepare clean dist folder
run: |
rm -rf dist
mkdir dist
# ⬇ Download only FRESH artifacts
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
# 🟢 Upload to GitHub Release
- name: Publish Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
draft: false
prerelease: false
# Only publish what we want:
files: |
dist/streamed-tui_linux_amd64
dist/streamed-tui_linux_arm64
dist/streamed-tui_darwin_amd64
dist/streamed-tui_darwin_arm64
dist/streamed-tui_*_source.tar.gz