ci: consolidate build workflows and automate Gitea releases

This commit is contained in:
Jose Luis Montañes Ojados
2026-01-17 02:54:04 +01:00
parent 71017f1e61
commit 1283fdc9c4
3 changed files with 104 additions and 87 deletions

View File

@@ -1,39 +0,0 @@
name: Build Linux
on: [push]
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: false
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libportaudio2 \
portaudio19-dev \
libopus-dev \
libopusfile-dev \
libpulse-dev \
pkg-config \
gcc
- name: Build TUI
run: |
export CGO_ENABLED=1
export ARCH=$(uname -m)
go build -o dist/tui_linux_${ARCH} ./cmd/tui
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: tui-linux-${{ github.sha }}
path: dist/

View File

@@ -1,48 +0,0 @@
name: Build Windows
on: [push]
jobs:
build-windows:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: false
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
path-type: inherit
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-opus
mingw-w64-x86_64-opusfile
mingw-w64-x86_64-portaudio
mingw-w64-x86_64-pkgconf
- name: Build TUI
run: |
# Ensure Go can find the C libraries via pkg-config
export CGO_ENABLED=1
go build -o dist/tui_windows.exe ./cmd/tui
# Copy necessary DLLs for portability
cp /mingw64/bin/libogg-0.dll dist/
cp /mingw64/bin/libopus-0.dll dist/
cp /mingw64/bin/libopusfile-0.dll dist/
cp /mingw64/bin/libportaudio-2.dll dist/ || true
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: tui-windows-binary
path: dist/

104
.gitea/workflows/build.yml Normal file
View File

@@ -0,0 +1,104 @@
name: Build and Release
on:
push:
branches: [master]
tags: ['v*']
jobs:
build-windows:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
cache: false
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
path-type: inherit
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-opus
mingw-w64-x86_64-opusfile
mingw-w64-x86_64-portaudio
mingw-w64-x86_64-pkgconf
zip
- name: Build TUI
run: |
export CGO_ENABLED=1
mkdir -p dist
go build -o dist/ts3-tui.exe ./cmd/tui
# Copy DLLs
cp /mingw64/bin/libogg-0.dll dist/
cp /mingw64/bin/libopus-0.dll dist/
cp /mingw64/bin/libopusfile-0.dll dist/
cp /mingw64/bin/libportaudio-2.dll dist/ || true
# Create ZIP
cd dist && zip -r ../tui_windows_x86_64.zip . *
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: tui-windows-zip
path: tui_windows_x86_64.zip
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
cache: false
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libportaudio2 portaudio19-dev \
libopus-dev libopusfile-dev \
libpulse-dev pkg-config gcc
- name: Build TUI
run: |
export CGO_ENABLED=1
export ARCH=$(uname -m)
mkdir -p dist
go build -o dist/tui_linux_${ARCH} ./cmd/tui
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: tui-linux-binaries
path: dist/*
release:
needs: [build-windows, build-linux]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
tui-windows-zip/tui_windows_x86_64.zip
tui-linux-binaries/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}