Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: Collect release files from build directory | |
| run: | | |
| echo "🔍 Collecting files from build directory..." | |
| mkdir -p release-files | |
| # Copy everything from build directory except unpacked folders | |
| find build/ -type f \( -name "*.exe" -o -name "*.dmg" -o -name "*.AppImage" -o -name "*.zip" -o -name "*.blockmap" -o -name "*.yml" \) \ | |
| -not -path "*/win-unpacked/*" \ | |
| -not -path "*/linux-unpacked/*" \ | |
| -not -path "*/mac-universal/*" \ | |
| -exec cp {} release-files/ \; | |
| # Also create zipped versions of unpacked directories | |
| if [ -d "build/win-unpacked" ]; then | |
| echo "📦 Zipping Windows unpacked directory..." | |
| cd build && zip -r ../release-files/ori-launcher-win-unpacked.zip win-unpacked/ && cd .. | |
| fi | |
| if [ -d "build/linux-unpacked" ]; then | |
| echo "📦 Zipping Linux unpacked directory..." | |
| cd build && zip -r ../release-files/ori-launcher-linux-unpacked.zip linux-unpacked/ && cd .. | |
| fi | |
| if [ -d "build/mac-universal" ]; then | |
| echo "📦 Zipping macOS unpacked directory..." | |
| cd build && zip -r ../release-files/ori-launcher-mac-unpacked.zip mac-universal/ && cd .. | |
| fi | |
| echo "📦 Release files collected:" | |
| ls -la release-files/ | |
| - name: Collect release files from build directory (Windows) | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| Write-Host "🔍 Collecting files from build directory..." | |
| New-Item -ItemType Directory -Force -Path "release-files" | |
| # Copy everything from build directory except unpacked folders | |
| Get-ChildItem -Recurse -Include "*.exe", "*.dmg", "*.AppImage", "*.zip", "*.blockmap", "*.yml" -Path "build" | | |
| Where-Object { | |
| $_.FullName -notmatch "win-unpacked" -and | |
| $_.FullName -notmatch "linux-unpacked" -and | |
| $_.FullName -notmatch "mac-universal" | |
| } | | |
| ForEach-Object { | |
| Copy-Item $_.FullName -Destination "release-files\" | |
| Write-Host "Copied: $($_.Name)" | |
| } | |
| # Also create zipped versions of unpacked directories | |
| if (Test-Path "build\win-unpacked") { | |
| Write-Host "📦 Zipping Windows unpacked directory..." | |
| Compress-Archive -Path "build\win-unpacked\*" -DestinationPath "release-files\ori-launcher-win-unpacked.zip" -Force | |
| } | |
| if (Test-Path "build\linux-unpacked") { | |
| Write-Host "📦 Zipping Linux unpacked directory..." | |
| Compress-Archive -Path "build\linux-unpacked\*" -DestinationPath "release-files\ori-launcher-linux-unpacked.zip" -Force | |
| } | |
| if (Test-Path "build\mac-universal") { | |
| Write-Host "📦 Zipping macOS unpacked directory..." | |
| Compress-Archive -Path "build\mac-universal\*" -DestinationPath "release-files\ori-launcher-mac-unpacked.zip" -Force | |
| } | |
| Write-Host "📦 Release files collected:" | |
| Get-ChildItem release-files/ | |
| - 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: Debug - List ALL files recursively (Linux/Mac) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| echo "=== FULL DIRECTORY STRUCTURE ===" | |
| find . -type f \( -name "*.exe" -o -name "*.dmg" -o -name "*.AppImage" -o -name "*.zip" -o -name "*.blockmap" -o -name "*.yml" \) | grep -v node_modules | sort | |
| echo "" | |
| echo "=== BUILD DIRECTORY ===" | |
| ls -la build/ 2>/dev/null || echo "No build directory" | |
| echo "" | |
| echo "=== DIST DIRECTORY ===" | |
| ls -la dist/ 2>/dev/null || echo "No dist directory" | |
| - name: Debug - List ALL files recursively (Windows) | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| Write-Host "=== FULL DIRECTORY STRUCTURE ===" | |
| Get-ChildItem -Recurse -Include "*.exe", "*.dmg", "*.AppImage", "*.zip", "*.blockmap", "*.yml" -Path . | Where-Object { $_.FullName -notmatch "node_modules" } | ForEach-Object { Write-Host $_.FullName } | |
| Write-Host "" | |
| Write-Host "=== BUILD DIRECTORY ===" | |
| if (Test-Path "build") { Get-ChildItem build/ -Recurse } else { Write-Host "No build directory" } | |
| Write-Host "" | |
| Write-Host "=== DIST DIRECTORY ===" | |
| if (Test-Path "dist") { Get-ChildItem dist/ -Recurse } else { Write-Host "No dist directory" } | |
| - name: Upload ALL build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ori-launcher-${{ matrix.platform }}-full | |
| path: | | |
| build/ | |
| dist/ | |
| *.exe | |
| *.dmg | |
| *.AppImage | |
| *.zip | |
| *.blockmap | |
| *.yml | |
| retention-days: 30 |