Skip to content

#22

#22 #26

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
- os: windows-latest
platform: win
- os: macos-14
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: Verify build script exists (Linux/Mac)
if: matrix.os != 'windows-latest'
run: |
echo "Checking if build.js exists..."
if [ -f "build.js" ]; then
echo "✅ build.js found"
echo "Script content preview:"
head -20 build.js
else
echo "❌ build.js not found!"
exit 1
fi
- name: Verify build script exists (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
Write-Host "Checking if build.js exists..."
if (Test-Path "build.js") {
Write-Host "✅ build.js found"
Write-Host "Script content preview:"
Get-Content build.js -Head 20
} else {
Write-Host "❌ build.js not found!"
exit 1
}
- name: Test build script syntax (Linux/Mac)
if: matrix.os != 'windows-latest'
run: node -c build.js
- name: Test build script syntax (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: node -c build.js
- name: Build Electron app with custom script (Linux/Mac)
if: matrix.os != 'windows-latest'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Running custom build script for ${{ matrix.platform }}..."
node build.js --build=platform
# Verify build output
echo "Build output verification:"
if [ -d "build" ]; then
echo "✅ Build directory created"
ls -la build/
else
echo "❌ No build directory found!"
exit 1
fi
- name: Build Electron app with custom script (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Write-Host "Running custom build script for Windows..."
node build.js --build=platform
# Verify build output
Write-Host "Build output verification:"
if (Test-Path "build") {
Write-Host "✅ Build directory created"
Get-ChildItem build/
} else {
Write-Host "❌ No build directory found!"
exit 1
}
- name: List final artifacts (Linux/Mac)
if: matrix.os != 'windows-latest'
run: |
echo "📦 Final artifacts:"
find . -name "*.exe" -o -name "*.dmg" -o -name "*.AppImage" -o -name "*.zip" | grep -v node_modules || echo "No distributable files found"
echo ""
echo "📁 Build directory contents:"
ls -la build/ 2>/dev/null || echo "No build directory"
echo ""
echo "📁 Dist directory contents:"
ls -la dist/ 2>/dev/null || echo "No dist directory"
- name: List final artifacts (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
Write-Host "📦 Final artifacts:"
Get-ChildItem -Recurse -Include "*.exe", "*.dmg", "*.AppImage", "*.zip" -Path . | Where-Object { $_.FullName -notmatch "node_modules" } | ForEach-Object { Write-Host $_.Name }
if (-not (Get-ChildItem -Recurse -Include "*.exe", "*.dmg", "*.AppImage", "*.zip" -Path . | Where-Object { $_.FullName -notmatch "node_modules" })) {
Write-Host "No distributable files found"
}
Write-Host ""
Write-Host "📁 Build directory contents:"
if (Test-Path "build") { Get-ChildItem build/ } else { Write-Host "No build directory" }
Write-Host ""
Write-Host "📁 Dist directory contents:"
if (Test-Path "dist") { Get-ChildItem dist/ } else { Write-Host "No dist directory" }
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ori-launcher-${{ matrix.platform }}
path: |
build/*
dist/*
retention-days: 30