Skip to content

- build attempt #15 #16

- build attempt #15

- build attempt #15 #16

Workflow file for this run

name: Build and Release Ori Launcher
on:
push:
tags: ['v*']
workflow_dispatch:
permissions:
contents: write
jobs:
sync-version:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Sync package.json version with tag
run: |
# Extract version from tag (remove 'v' prefix)
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
echo "Syncing package.json version to: $TAG_VERSION"
# Update package.json
npm version $TAG_VERSION --no-git-tag-version --allow-same-version
# Verify the change
echo "Updated package.json version: $(node -p "require('./package.json').version")"
- name: Upload updated package.json
uses: actions/upload-artifact@v4
with:
name: updated-package
path: package.json
retention-days: 1
build-and-release:
needs: sync-version
strategy:
matrix:
include:
- os: ubuntu-22.04
platform: linux
electron_platform: linux
- os: windows-latest
platform: win
electron_platform: win
- os: macos-14
platform: mac
electron_platform: mac
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download updated package.json
uses: actions/download-artifact@v4
with:
name: updated-package
path: ./
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
npm cache clean --force
npm install --no-audit --no-fund
- name: Install dependencies (Linux/Mac)
if: matrix.os != 'windows-latest'
run: npm ci
- name: Build frontend with Vite (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: npm run build:ui
- name: Build frontend with Vite (Linux/Mac)
if: matrix.os != 'windows-latest'
run: npm run build:ui
- name: Copy Electron source files (Linux/Mac)
if: matrix.os != 'windows-latest'
run: |
mkdir -p appsrc/electron
mkdir -p appsrc/locale
cp -r src/electron/* appsrc/electron/ || echo "No electron files to copy"
cp -r locale/* appsrc/locale/ 2>/dev/null || echo "No locale files to copy"
echo "✅ Source files copied to appsrc/"
- name: Copy Electron source files (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path "appsrc\electron"
New-Item -ItemType Directory -Force -Path "appsrc\locale"
if (Test-Path "src\electron") {
Copy-Item -Recurse -Path "src\electron\*" -Destination "appsrc\electron\" -Force
Write-Host "✅ Electron files copied"
} else {
Write-Host "No electron files to copy"
}
if (Test-Path "locale") {
Copy-Item -Recurse -Path "locale\*" -Destination "appsrc\locale\" -Force
Write-Host "✅ Locale files copied"
} else {
Write-Host "No locale files to copy"
}
- name: Rebuild native modules (Linux/Mac)
if: matrix.os != 'windows-latest'
run: npm run rebuild
- name: Skip rebuild (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: Write-Host "Skipping rebuild on Windows to avoid timeout issues"
- name: Build Electron app (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx electron-builder --win --x64
- name: Build Electron app (Linux)
if: matrix.os == 'ubuntu-22.04'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx electron-builder --linux --x64 -c.linux.target=AppImage
- name: Build Electron app (Mac)
if: matrix.os == 'macos-14'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx electron-builder --mac --universal
- name: List build artifacts (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
Write-Host "📁 Build directory contents:"
Get-ChildItem -Path "build" -ErrorAction SilentlyContinue | ForEach-Object { Write-Host $_.Name }
Write-Host ""
Write-Host "📁 Dist directory contents:"
Get-ChildItem -Path "dist" -ErrorAction SilentlyContinue | ForEach-Object { Write-Host $_.Name }
- name: List build artifacts (Linux/Mac)
if: matrix.os != 'windows-latest'
run: |
echo "📁 Build directory contents:"
ls -la build/ 2>/dev/null || echo "No build directory found"
echo ""
echo "📁 Dist directory contents:"
ls -la dist/ 2>/dev/null || echo "No dist directory found"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ori-launcher-${{ matrix.platform }}
path: |
build/*
dist/*
retention-days: 30
create-release:
needs: build-and-release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: List downloaded artifacts
run: |
echo "📦 Downloaded artifacts:"
find ./artifacts -name "*.exe" -o -name "*.dmg" -o -name "*.AppImage" -o -name "*.zip" | sort
echo ""
echo "📊 File sizes:"
find ./artifacts -name "*.exe" -o -name "*.dmg" -o -name "*.AppImage" -o -name "*.zip" -exec ls -lh {} \;
- name: Install GitHub CLI
run: |
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update && sudo apt install gh -y
- name: Delete existing release (if any)
run: |
# Silently delete if exists, ignore if doesn't
gh release delete "${{ github.ref_name }}" --yes 2>/dev/null || true
echo "✅ Cleaned up any existing release"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
run: |
# Create the release first
gh release create "${{ github.ref_name }}" \
--title "Ori Launcher ${{ github.ref_name }}" \
--notes-file <(echo "Automated release of Ori Launcher ${{ github.ref_name }}") \
--generate-notes
echo "✅ Release created successfully"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release assets
run: |
# Upload each main installer file individually
echo "📤 Uploading release assets..."
# Windows installer
WINDOWS_EXE=$(find ./artifacts -name "*.exe" -not -path "*/win-unpacked/*" | head -1)
if [ -f "$WINDOWS_EXE" ]; then
echo "⬆️ Uploading Windows installer..."
gh release upload "${{ github.ref_name }}" "$WINDOWS_EXE" --clobber
fi
# macOS .dmg
MAC_DMG=$(find ./artifacts -name "*.dmg" | head -1)
if [ -f "$MAC_DMG" ]; then
echo "⬆️ Uploading macOS .dmg..."
gh release upload "${{ github.ref_name }}" "$MAC_DMG" --clobber
fi
# macOS .zip (optional - skip if problematic)
MAC_ZIP=$(find ./artifacts -name "*.zip" | head -1)
if [ -f "$MAC_ZIP" ]; then
echo "⬆️ Uploading macOS .zip..."
gh release upload "${{ github.ref_name }}" "$MAC_ZIP" --clobber || echo "⚠️ Skipped .zip upload"
fi
# Linux AppImage
LINUX_APPIMAGE=$(find ./artifacts -name "*.AppImage" | head -1)
if [ -f "$LINUX_APPIMAGE" ]; then
echo "⬆️ Uploading Linux AppImage..."
gh release upload "${{ github.ref_name }}" "$LINUX_APPIMAGE" --clobber
fi
echo "✅ All assets uploaded successfully!"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}