Files
strands/.github/workflows/gobuild.yml
2025-02-05 11:25:24 -05:00

83 lines
2.2 KiB
YAML

name: Release Strands
on:
release:
types:
- created
workflow_dispatch:
inputs:
commit:
description: "Commit SHA to build (leave empty for latest)"
required: false
jobs:
build:
name: Build for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
goos: linux
goarch: amd64
cc: gcc
cxx: g++
- os: windows-latest
goos: windows
goarch: amd64
cc: x86_64-w64-mingw32-gcc
cxx: x86_64-w64-mingw32-g++
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install xorg-dev libgl1-mesa-dev libopenal1 libopenal-dev libvorbis0a libvorbis-dev libvorbisfile3
- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: choco install mingw
- name: Build
run: |
go env -w CGO_ENABLED=1 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }}
go build -o strands-${{ matrix.goos }}-${{ matrix.goarch }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: strands-${{ matrix.goos }}-${{ matrix.goarch }}
path: strands-${{ matrix.goos }}-${{ matrix.goarch }}
release:
name: Create Release Artifacts
needs: build
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Archive binaries
run: |
cd artifacts
tar -czf strands-linux-amd64.tar.gz strands-linux-amd64
zip strands-windows-amd64.zip strands-windows-amd64
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/strands-linux-amd64.tar.gz
artifacts/strands-windows-amd64.zip