CI Fix: Increase npm reliability and add caching to release workflow #22
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 | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| jobs: | |
| release: | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: write | |
| strategy: | |
| matrix: | |
| os: [windows-latest, ubuntu-latest] | |
| steps: | |
| - name: Check out Git repository | |
| uses: actions/checkout@v4 | |
| - name: Delete existing release (if exists) | |
| shell: bash | |
| run: | | |
| gh release delete ${{ github.ref_name }} --yes || true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'npm' | |
| cache-dependency-path: './electron-app/package-lock.json' | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| cd electron-app | |
| npm config set fetch-retries 10 | |
| npm config set fetch-retry-mintimeout 20000 | |
| npm config set fetch-retry-maxtimeout 120000 | |
| npm ci --prefer-offline --no-audit | |
| - name: Install Python dependencies | |
| run: | | |
| pip install -r backend/requirements.txt | |
| pip install pyinstaller | |
| - name: Build Backend with PyInstaller | |
| run: | | |
| cd backend | |
| pyinstaller --onefile --noconsole api_server.py | |
| # Move binary to backend root so it's picked up by extraResources | |
| if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
| mv dist/api_server.exe . | |
| else | |
| mv dist/api_server . | |
| fi | |
| shell: bash | |
| - name: Build and Publish Electron | |
| run: | | |
| cd electron-app | |
| npm run electron:build | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |