try again #38
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 Electron Application | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
# This will continue to run other platforms even if one fails | |
fail-fast: false | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
# Disable caching since lock file may not be available | |
- name: Install dependencies | |
# Use install instead of ci since lock file may not be available | |
run: npm install | |
- name: Build application | |
run: npm run build | |
# Set environment variables for the entire job using the env context at the job level | |
# instead of as a separate step | |
- name: Package application (Windows) | |
if: matrix.os == 'windows-latest' | |
run: npm run package-win | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
- name: Package application (macOS) | |
if: matrix.os == 'macos-latest' | |
run: | | |
# Build .app files for both architectures | |
npm run package-mac | |
# Debug - show directory contents after build | |
echo "=== Contents of dist directory ===" | |
ls -la dist/ || echo "dist directory not found" | |
# Check if the mac and mac-arm64 directories were created | |
if [ -d "dist/mac" ]; then | |
echo "=== Contents of dist/mac ===" | |
ls -la dist/mac/ | |
else | |
echo "dist/mac directory not found!" | |
fi | |
if [ -d "dist/mac-arm64" ]; then | |
echo "=== Contents of dist/mac-arm64 ===" | |
ls -la dist/mac-arm64/ | |
else | |
echo "dist/mac-arm64 directory not found!" | |
fi | |
# Create completely separate artifact directories outside of the dist folder | |
mkdir -p macos-intel-artifact | |
mkdir -p macos-silicon-artifact | |
# Process Intel build | |
if [ -d "dist/mac/BlitzLauncher.app" ]; then | |
echo "Removing quarantine attributes from Intel build" | |
sudo xattr -cr dist/mac/BlitzLauncher.app | |
echo "Copying Intel build to dedicated artifact directory" | |
cp -r dist/mac/BlitzLauncher.app macos-intel-artifact/ | |
# Create basic readme so users know what this is | |
echo "BlitzLauncher for macOS (Intel/x64)" > macos-intel-artifact/README.txt | |
else | |
echo "Intel build not found at expected location: dist/mac/BlitzLauncher.app" | |
echo "Build not found" > macos-intel-artifact/MISSING.txt | |
fi | |
# Process ARM build | |
if [ -d "dist/mac-arm64/BlitzLauncher.app" ]; then | |
echo "Removing quarantine attributes from ARM build" | |
sudo xattr -cr dist/mac-arm64/BlitzLauncher.app | |
echo "Copying ARM build to dedicated artifact directory" | |
cp -r dist/mac-arm64/BlitzLauncher.app macos-silicon-artifact/ | |
# Create basic readme so users know what this is | |
echo "BlitzLauncher for macOS (Apple Silicon/ARM64)" > macos-silicon-artifact/README.txt | |
else | |
echo "ARM build not found at expected location: dist/mac-arm64/BlitzLauncher.app" | |
echo "Build not found" > macos-silicon-artifact/MISSING.txt | |
fi | |
# Show what's in each artifact directory | |
echo "=== Intel artifact directory contents ===" | |
ls -la macos-intel-artifact/ | |
echo "=== Apple Silicon artifact directory contents ===" | |
ls -la macos-silicon-artifact/ | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
# Upload macOS Intel build as separate step with very explicit path | |
- name: Upload macOS Intel artifact | |
if: matrix.os == 'macos-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "BlitzLauncher-macos-intel" | |
path: macos-intel-artifact | |
if-no-files-found: warn | |
# Upload macOS ARM build as separate step with very explicit path | |
- name: Upload macOS ARM artifact | |
if: matrix.os == 'macos-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "BlitzLauncher-macos-apple-silicon" | |
path: macos-silicon-artifact | |
if-no-files-found: warn | |
- name: Package application (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
run: npm run package-linux | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
# Upload artifacts for Windows and Linux | |
- name: Upload Windows and Linux artifacts | |
if: matrix.os != 'macos-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "BlitzLauncher-${{ matrix.os }}.${{ matrix.os == 'windows-latest' && 'exe' || 'AppImage' }}" | |
path: | | |
dist/*.exe | |
dist/*.AppImage | |
dist/*.deb | |
if-no-files-found: warn |