Skip to content

Build and Release

Build and Release #7

Workflow file for this run

name: Build and Release
on:
workflow_dispatch:
jobs:
build-binary:
name: Build Linux Binaries
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24.11"
cache: true
- name: Build Linux amd64 Binary
run: |
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -v -o smsie-linux-amd64 main.go
- name: Build Linux arm64 Binary
run: |
CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -v -o smsie-linux-arm64 main.go
- name: Build Linux arm Binary
run: |
CGO_ENABLED=1 GOOS=linux GOARCH=arm go build -v -o smsie-linux-arm main.go
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: binaries-linux
path: |
smsie-linux-amd64
smsie-linux-arm64
smsie-linux-arm
build-windows:
name: Build Windows Binary (MSYS2 MinGW64)
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24.11"
cache: true
- name: Set up MSYS2 (MinGW64)
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
path-type: inherit
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-pkgconf
mingw-w64-x86_64-portaudio
mingw-w64-x86_64-libusb
mingw-w64-x86_64-ffmpeg
- name: Build Windows amd64 Binary (CGO)
shell: msys2 {0}
run: |
export CGO_ENABLED=1
export CC=gcc
export CXX=g++
go build -v -o smsie-windows-amd64.exe main.go
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: binaries-windows
path: smsie-windows-amd64.exe
build-container:
name: Build Container
runs-on: ubuntu-latest
needs: build-binary # Optional, can run in parallel
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
# Enable multi-platform build for Linux amd64, arm64, and arm v7
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: ghcr.io/${{ github.repository }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
release:
name: Create Release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [build-binary, build-windows, build-container]
permissions:
contents: write
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
pattern: binaries-*
merge-multiple: true
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
smsie-linux-amd64
smsie-linux-arm64
smsie-linux-arm
smsie-windows-amd64.exe
draft: false
prerelease: false