GH Build & Release (WIN) #1
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: | |
| branches: [ main, master ] | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: [ main, master ] | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build renderer | |
| run: npm run build:renderer | |
| - name: Build Electron app for Windows | |
| run: npm run build | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload Windows artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-build | |
| path: | | |
| dist/*.exe | |
| dist/*.msi | |
| dist/*.zip | |
| dist/*Setup*.exe | |
| dist/*Portable*.exe | |
| retention-days: 30 | |
| if-no-files-found: warn | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download Windows artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: windows-build | |
| path: dist/ | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| dist/*.exe | |
| dist/*.msi | |
| dist/*.zip | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| name: Release ${{ github.ref_name }} | |
| tag_name: ${{ github.ref_name }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Optional: Build on every push for testing (without release) | |
| build-on-push: | |
| runs-on: windows-latest | |
| if: ${{ !startsWith(github.ref, 'refs/tags/v') }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build renderer | |
| run: npm run build:renderer | |
| - name: Test build (without publishing) | |
| run: npx electron-builder --windows --publish never | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |