218 lines
6.9 KiB
YAML
218 lines
6.9 KiB
YAML
name: Build Client for All Platforms
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, develop ]
|
|
paths:
|
|
- 'Client/**'
|
|
pull_request:
|
|
branches: [ main ]
|
|
paths:
|
|
- 'Client/**'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '18'
|
|
cache: 'npm'
|
|
cache-dependency-path: Client/package-lock.json
|
|
|
|
- name: Install system dependencies (Ubuntu)
|
|
if: matrix.os == 'ubuntu-latest'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libnss3-dev libatk-bridge2.0-dev libdrm2 libxkbcommon-dev libxcomposite-dev libxdamage-dev libxrandr-dev libgbm-dev libxss1 libasound2-dev
|
|
|
|
- name: Install system dependencies (macOS)
|
|
if: matrix.os == 'macos-latest'
|
|
run: |
|
|
# Install Xcode command line tools if not present
|
|
xcode-select --install 2>/dev/null || true
|
|
|
|
- name: Install system dependencies (Windows)
|
|
if: matrix.os == 'windows-latest'
|
|
run: |
|
|
# Windows builds typically have required dependencies pre-installed
|
|
# Ensure chocolatey is available for any additional packages
|
|
choco --version || echo "Chocolatey not available"
|
|
|
|
- name: Install dependencies
|
|
working-directory: ./Client
|
|
run: |
|
|
if [ "${{ matrix.os }}" = "windows-latest" ]; then
|
|
npm ci --include=dev
|
|
else
|
|
npm ci
|
|
fi
|
|
shell: bash
|
|
|
|
- name: Clean previous builds (Windows)
|
|
if: matrix.os == 'windows-latest'
|
|
working-directory: ./Client
|
|
run: if exist dist rmdir /s /q dist
|
|
shell: cmd
|
|
|
|
- name: Clean previous builds (Unix)
|
|
if: matrix.os != 'windows-latest'
|
|
working-directory: ./Client
|
|
run: rm -rf dist
|
|
shell: bash
|
|
|
|
- name: Build for Linux
|
|
if: matrix.os == 'ubuntu-latest'
|
|
working-directory: ./Client
|
|
run: npm run build-linux
|
|
|
|
- name: Build for Windows
|
|
if: matrix.os == 'windows-latest'
|
|
working-directory: ./Client
|
|
run: npm run build-win
|
|
|
|
- name: Build for macOS
|
|
if: matrix.os == 'macos-latest'
|
|
working-directory: ./Client
|
|
run: npm run build-mac
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: client-${{ matrix.os }}
|
|
path: Client/dist/
|
|
retention-days: 30
|
|
continue-on-error: true
|
|
|
|
package:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
|
|
- name: Create release directory
|
|
run: mkdir -p release
|
|
|
|
- name: Organize executables by platform
|
|
run: |
|
|
# Create platform directories
|
|
mkdir -p release/Windows
|
|
mkdir -p release/macOS
|
|
mkdir -p release/Linux
|
|
|
|
# Windows executables
|
|
if [ -d "artifacts/client-windows-latest" ]; then
|
|
find artifacts/client-windows-latest -name "*.exe" -type f -exec cp {} release/Windows/ \;
|
|
find artifacts/client-windows-latest -name "*.msi" -type f -exec cp {} release/Windows/ \;
|
|
fi
|
|
|
|
# macOS executables
|
|
if [ -d "artifacts/client-macos-latest" ]; then
|
|
find artifacts/client-macos-latest -name "*.dmg" -type f -exec cp {} release/macOS/ \;
|
|
find artifacts/client-macos-latest -name "*.app" -type d -exec cp -r {} release/macOS/ \;
|
|
find artifacts/client-macos-latest -name "*.zip" -type f -exec cp {} release/macOS/ \;
|
|
fi
|
|
|
|
# Linux executables
|
|
if [ -d "artifacts/client-ubuntu-latest" ]; then
|
|
find artifacts/client-ubuntu-latest -name "*.AppImage" -type f -exec cp {} release/Linux/ \;
|
|
find artifacts/client-ubuntu-latest -name "*.deb" -type f -exec cp {} release/Linux/ \;
|
|
find artifacts/client-ubuntu-latest -name "*.rpm" -type f -exec cp {} release/Linux/ \;
|
|
fi
|
|
|
|
# List what we actually got
|
|
echo "=== Executables Found ==="
|
|
find release -type f -name "*" -o -name "*.app" | head -20 || true
|
|
|
|
# Create platform info file
|
|
cat > release/README.txt << EOF
|
|
Galaxy Strike Online - Multi-Platform Client
|
|
==========================================
|
|
|
|
Windows:
|
|
- Run the .exe installer or portable executable
|
|
|
|
macOS:
|
|
- Open the .dmg file and drag to Applications
|
|
- Or extract the .zip and run the .app
|
|
|
|
Linux:
|
|
- Make the .AppImage executable: chmod +x *.AppImage
|
|
- Or install the .deb package: sudo dpkg -i *.deb
|
|
|
|
Build Date: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
|
|
Commit: ${{ github.sha }}
|
|
EOF
|
|
|
|
- name: Create all-in-one zip
|
|
run: |
|
|
cd release
|
|
zip -r ../Galaxy-Strike-Online-Client-${{ github.sha }}.zip .
|
|
|
|
- name: Upload all-in-one zip
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: galaxy-strike-online-client-all-platforms
|
|
path: Galaxy-Strike-Online-Client-${{ github.sha }}.zip
|
|
retention-days: 90
|
|
|
|
- name: Create Release (Main Branch)
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: Galaxy-Strike-Online-Client-${{ github.sha }}.zip
|
|
name: Galaxy Strike Online Client - Latest
|
|
body: |
|
|
Latest multi-platform client release for Galaxy Strike Online.
|
|
|
|
Includes:
|
|
- Windows (NSIS installer + Portable)
|
|
- macOS (DMG + ZIP)
|
|
- Linux (AppImage + Debian package)
|
|
|
|
Commit: ${{ github.sha }}
|
|
Build Date: ${{ github.event.head_commit.timestamp }}
|
|
|
|
**Download the all-in-one zip file below for all platforms.**
|
|
draft: false
|
|
prerelease: false
|
|
tag_name: latest
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Create Release (Tags)
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: Galaxy-Strike-Online-Client-${{ github.sha }}.zip
|
|
name: Galaxy Strike Online Client - ${{ github.ref_name }}
|
|
body: |
|
|
Multi-platform client release for Galaxy Strike Online.
|
|
|
|
Includes:
|
|
- Windows (NSIS installer + Portable)
|
|
- macOS (DMG + ZIP)
|
|
- Linux (AppImage + Debian package)
|
|
|
|
Commit: ${{ github.sha }}
|
|
draft: false
|
|
prerelease: false
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|