Skip to content

- build attempt #13 #14

- build attempt #13

- build attempt #13 #14

Workflow file for this run

name: Build and Release Ori Launcher
on:
push:
tags: ['v*']
workflow_dispatch: # Allow manual triggers
permissions:
contents: write
jobs:
build-and-release:
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
with:
fetch-depth: 0
- 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: Check if release exists and delete it
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "🔍 Checking for release with tag: ${{ github.ref_name }}"
# Check if release exists for the CURRENT tag
response=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ github.ref_name }}")
echo "Release check HTTP status: $response"
# If release exists (200), delete it
if [ "$response" = "200" ]; then
echo "🗑️ Deleting existing release for tag: ${{ github.ref_name }}..."
curl -X DELETE \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ github.ref_name }}"
echo "✅ Release deleted"
# Wait a bit longer for GitHub to process
sleep 10
else
echo "✅ No existing release found for tag: ${{ github.ref_name }} (status: $response)"
fi
- name: Prepare clean artifact paths
run: |
# Create a clean directory with only the main distributables
mkdir -p release-files
# Copy only the main installer files, not unpacked contents
find ./artifacts -name "*.exe" -not -path "*/win-unpacked/*" -exec cp {} release-files/ \;
find ./artifacts -name "*.dmg" -exec cp {} release-files/ \;
find ./artifacts -name "*.AppImage" -exec cp {} release-files/ \;
find ./artifacts -name "*.zip" -exec cp {} release-files/ \;
echo "🎯 Release files prepared:"
ls -la release-files/
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: release-files/*
generate_release_notes: true
draft: false
prerelease: false