Skip to content

[Quality] KISS: GitHub Actions deploys Electron app to GitHub Pages (wrong approach) #29

Description

@newtontech

实际问题

文件: .github/workflows/deploy.yml

代码:

name: Deploy to GitHub Pages
...
    - name: Build
      run: npm run make || npm run build || echo "No build script"
    
    - name: Upload artifact
      uses: actions/upload-pages-artifact@v3
      with:
        path: ./out
    
    - name: Deploy to GitHub Pages
      uses: actions/deploy-pages@v4

问题:

  1. This is an Electron desktop application (not a web app), but the workflow deploys to GitHub Pages
  2. npm run make builds native desktop installers (.exe, .dmg, .AppImage), not static web files
  3. Electron apps cannot run in a browser - they require Node.js/Electron runtime
  4. The ./out directory assumption is incorrect for electron-forge

改进建议

Option A - For Desktop App: Remove GitHub Pages deployment, use GitHub Releases instead:

name: Build and Release

on:
  push:
    tags:
      - "v*"

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: "20"
      - run: npm install
      - run: npm run make
      - name: Upload artifacts
        uses: actions/upload-artifact@v4
        with:
          name: molviz-${{ matrix.os }}
          path: out/make/**

Option B - For Web App: If you want a web version, create a separate web build using Vite/Webpack that bundles the Three.js renderer for browser-only usage.

为什么重要

  • Severity: HIGH - Current workflow will fail or produce broken deployments
  • Electron apps deployed to GitHub Pages simply won't work
  • Users downloading from GitHub Pages will get non-functional files
  • Wastes CI/CD resources on incorrect deployment approach

优先级

  • 高 - 影响系统稳定性/安全性
  • 中 - 影响代码质量
  • 低 - 改进建议

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions