From 1283fdc9c4aaa72cbc118edc78621c808d126e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Luis=20Monta=C3=B1es=20Ojados?= Date: Sat, 17 Jan 2026 02:54:04 +0100 Subject: [PATCH] ci: consolidate build workflows and automate Gitea releases --- .gitea/workflows/build-linux.yml | 39 ----------- .gitea/workflows/build-windows.yml | 48 ------------- .gitea/workflows/build.yml | 104 +++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+), 87 deletions(-) delete mode 100644 .gitea/workflows/build-linux.yml delete mode 100644 .gitea/workflows/build-windows.yml create mode 100644 .gitea/workflows/build.yml diff --git a/.gitea/workflows/build-linux.yml b/.gitea/workflows/build-linux.yml deleted file mode 100644 index 779d621..0000000 --- a/.gitea/workflows/build-linux.yml +++ /dev/null @@ -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/ diff --git a/.gitea/workflows/build-windows.yml b/.gitea/workflows/build-windows.yml deleted file mode 100644 index d6d3b9e..0000000 --- a/.gitea/workflows/build-windows.yml +++ /dev/null @@ -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/ diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..fb59734 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -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 }}