mirror of
https://wiilab.wiimart.org/wiimart/WiiSOAP
synced 2025-09-03 20:11:14 +02:00
86 lines
2.4 KiB
YAML
86 lines
2.4 KiB
YAML
name: Go Cross-Platform Build
|
|
|
|
on:
|
|
push:
|
|
branches: ["master"]
|
|
pull_request:
|
|
branches: ["master"]
|
|
workflow_dispatch:
|
|
inputs:
|
|
optional_input:
|
|
description: 'Only run when needed'
|
|
required: false
|
|
default: ''
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
include:
|
|
- os: ubuntu-latest
|
|
display_name: "linux"
|
|
bin_name: "WiiSOAP"
|
|
- os: windows-latest
|
|
display_name: "windows"
|
|
bin_name: "WiiSOAP.exe"
|
|
- os: macos-latest # Apple Silicon
|
|
display_name: "mac-apple-silicon"
|
|
bin_name: "WiiSOAP"
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v4
|
|
with:
|
|
go-version: '1.23'
|
|
|
|
# Windows Build (PowerShell)
|
|
- name: Build (Windows)
|
|
if: runner.os == 'Windows'
|
|
shell: pwsh
|
|
run: |
|
|
$env:GOOS="windows"
|
|
$env:GOARCH="amd64"
|
|
go build -v -o "${{ matrix.bin_name }}" ./...
|
|
|
|
# Linux/macOS Build (Bash)
|
|
- name: Build (Linux/macOS)
|
|
if: runner.os != 'Windows'
|
|
shell: bash
|
|
run: |
|
|
GOOS=${{ runner.os == 'macOS' && 'darwin' || 'linux' }} \
|
|
GOARCH=${{ matrix.os == 'macos-14' && 'arm64' || 'amd64' }} \
|
|
go build -v -o "${{ matrix.bin_name }}" ./...
|
|
|
|
# Linux/macOS Zipping
|
|
- name: Create ZIP (Linux/macOS)
|
|
if: runner.os != 'Windows'
|
|
shell: bash
|
|
run: |
|
|
mkdir -p release
|
|
cp "${{ matrix.bin_name }}" release/
|
|
cp config.example.xml release/
|
|
zip -r "wiisoap-${{ matrix.display_name }}.zip" release/
|
|
|
|
# Windows Zipping (using 7zip since Windows hates us)
|
|
- name: Install 7-Zip (Windows)
|
|
if: runner.os == 'Windows'
|
|
shell: pwsh
|
|
run: |
|
|
choco install 7zip -y --no-progress
|
|
|
|
- name: Create ZIP (Windows)
|
|
if: runner.os == 'Windows'
|
|
shell: pwsh
|
|
run: |
|
|
New-Item -ItemType Directory -Path release -Force
|
|
Copy-Item "${{ matrix.bin_name }}" release/
|
|
Copy-Item config.example.xml release/
|
|
7z a "wiisoap-${{ matrix.display_name }}.zip" .\release\*
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: "wiisoap-${{ matrix.display_name }}"
|
|
path: "wiisoap-${{ matrix.display_name }}.zip"
|