build(deps-dev): bump electron from 25.9.8 to 39.8.5 #30
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 Electron App | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build TypeScript and Vite | |
| run: npm run build:ci | |
| - name: Upload Windows artifacts | |
| if: matrix.os == 'windows-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-build | |
| path: | | |
| dist-electron/**/* | |
| dist/**/* | |
| retention-days: 30 | |
| - name: Upload macOS artifacts | |
| if: matrix.os == 'macos-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-build | |
| path: | | |
| dist-electron/**/* | |
| dist/**/* | |
| retention-days: 30 | |
| - name: Upload Linux artifacts | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-build | |
| path: | | |
| dist-electron/**/* | |
| dist/**/* | |
| retention-days: 30 | |
| package: | |
| name: Package ${{ matrix.os }} | |
| needs: build | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Download artifacts (Windows) | |
| if: matrix.os == 'windows-latest' | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: windows-build | |
| - name: Download artifacts (macOS) | |
| if: matrix.os == 'macos-latest' | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: macos-build | |
| - name: Download artifacts (Linux) | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: linux-build | |
| - name: Package Electron App (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: npm run electron:pack | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Package Electron App (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: npm run electron:pack | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Package Electron App (Linux) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: npm run electron:pack | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload Windows Package | |
| if: matrix.os == 'windows-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-package | |
| path: dist/*.exe | |
| retention-days: 30 | |
| - name: Upload macOS Package | |
| if: matrix.os == 'macos-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-package | |
| path: dist/*.dmg | |
| retention-days: 30 | |
| - name: Upload Linux Package | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-package | |
| path: dist/*.AppImage | |
| retention-days: 30 | |
| release: | |
| name: Create Release | |
| needs: package | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop') | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Get version from package.json | |
| id: package-version | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Create Release Tag | |
| id: create-tag | |
| run: | | |
| BRANCH_NAME=${GITHUB_REF#refs/heads/} | |
| if [ "$BRANCH_NAME" = "main" ]; then | |
| TAG="v${{ steps.package-version.outputs.version }}-release-$(date +%Y%m%d-%H%M%S)" | |
| else | |
| TAG="v${{ steps.package-version.outputs.version }}-$BRANCH_NAME-$(date +%Y%m%d-%H%M%S)" | |
| fi | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT | |
| - name: List artifact files | |
| run: | | |
| echo "Listing all artifacts:" | |
| find artifacts -type f | |
| - name: Create GitHub Release using GitHub CLI | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG: ${{ steps.create-tag.outputs.tag }} | |
| VERSION: ${{ steps.package-version.outputs.version }} | |
| BRANCH: ${{ steps.create-tag.outputs.branch }} | |
| run: | | |
| # Determine if this is a prerelease | |
| if [ "$BRANCH" = "main" ]; then | |
| PRERELEASE="" | |
| else | |
| PRERELEASE="--prerelease" | |
| fi | |
| # Create release notes | |
| cat > release_notes.md << EOF | |
| Automated release for testing | |
| **Version:** $VERSION | |
| **Branch:** ${GITHUB_REF} | |
| **Commit:** ${GITHUB_SHA} | |
| ## Platform Downloads | |
| Download the installer for your platform from the Assets section below: | |
| - **Windows**: \`.exe\` installer | |
| - **macOS**: \`.dmg\` installer | |
| - **Linux**: \`.AppImage\` | |
| ## Installation | |
| ### Windows | |
| 1. Download the \`.exe\` file | |
| 2. Run the installer | |
| 3. You may see a SmartScreen warning (packages are not yet code-signed) | |
| ### macOS | |
| 1. Download the \`.dmg\` file | |
| 2. Open the DMG and drag the app to Applications | |
| 3. You may need to allow the app in System Preferences > Security & Privacy | |
| ### Linux | |
| 1. Download the \`.AppImage\` file | |
| 2. Make it executable: \`chmod +x *.AppImage\` | |
| 3. Run it: \`./Project-Pulse*.AppImage\` | |
| EOF | |
| # Create the release | |
| gh release create "$TAG" \ | |
| --title "Release $TAG" \ | |
| --notes-file release_notes.md \ | |
| $PRERELEASE \ | |
| artifacts/windows-package/*.exe \ | |
| artifacts/macos-package/*.dmg \ | |
| artifacts/linux-package/*.AppImage 2>/dev/null || \ | |
| gh release create "$TAG" \ | |
| --title "Release $TAG" \ | |
| --notes-file release_notes.md \ | |
| $PRERELEASE |