ci: consolidate build workflows and automate Gitea releases
This commit is contained in:
104
.gitea/workflows/build.yml
Normal file
104
.gitea/workflows/build.yml
Normal 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 }}
|
||||
Reference in New Issue
Block a user