|
| 1 | +name: Build and Make Electron App |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - nx |
| 7 | + # - master # Uncomment this when ready to run on master branch |
| 8 | + tags: |
| 9 | + - 'v*.*.*' |
| 10 | + pull_request: |
| 11 | + branches: |
| 12 | + - nx |
| 13 | + # - master # Uncomment this when ready to run on master branch |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + name: Build on ${{ matrix.os }} |
| 19 | + runs-on: ${{ matrix.os }} |
| 20 | + timeout-minutes: 60 |
| 21 | + strategy: |
| 22 | + matrix: |
| 23 | + os: [macos-latest, ubuntu-latest, windows-latest] |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Checkout code |
| 27 | + uses: actions/checkout@v4 |
| 28 | + |
| 29 | + - name: Install pnpm |
| 30 | + uses: pnpm/action-setup@v4 |
| 31 | + with: |
| 32 | + version: 10 |
| 33 | + |
| 34 | + - name: Setup Node.js |
| 35 | + uses: actions/setup-node@v4 |
| 36 | + with: |
| 37 | + node-version: '22' |
| 38 | + cache: 'pnpm' |
| 39 | + |
| 40 | + - name: Install dependencies |
| 41 | + run: pnpm install --no-frozen-lockfile |
| 42 | + |
| 43 | + - name: Build frontend |
| 44 | + run: npm run build:frontend |
| 45 | + |
| 46 | + - name: Build backend |
| 47 | + run: npm run build:backend |
| 48 | + |
| 49 | + - name: Make Electron app |
| 50 | + run: npm run make:app |
| 51 | + |
| 52 | + - name: Upload artifacts (macOS) |
| 53 | + if: matrix.os == 'macos-latest' |
| 54 | + uses: actions/upload-artifact@v4 |
| 55 | + with: |
| 56 | + name: macos-artifacts |
| 57 | + path: | |
| 58 | + dist/executables/**/*.dmg |
| 59 | + dist/executables/**/*.zip |
| 60 | + retention-days: 7 |
| 61 | + |
| 62 | + - name: Upload artifacts (Linux) |
| 63 | + if: matrix.os == 'ubuntu-latest' |
| 64 | + uses: actions/upload-artifact@v4 |
| 65 | + with: |
| 66 | + name: linux-artifacts |
| 67 | + path: | |
| 68 | + dist/executables/**/*.deb |
| 69 | + dist/executables/**/*.rpm |
| 70 | + dist/executables/**/*.snap |
| 71 | + dist/executables/**/*.AppImage |
| 72 | + dist/executables/**/*.tar.gz |
| 73 | + retention-days: 7 |
| 74 | + |
| 75 | + - name: Upload artifacts (Windows) |
| 76 | + if: matrix.os == 'windows-latest' |
| 77 | + uses: actions/upload-artifact@v4 |
| 78 | + with: |
| 79 | + name: windows-artifacts |
| 80 | + path: | |
| 81 | + dist/executables/**/*.exe |
| 82 | + dist/executables/**/*.msi |
| 83 | + dist/executables/**/*.zip |
| 84 | + retention-days: 7 |
| 85 | + |
| 86 | + create-release: |
| 87 | + name: Create Draft Release |
| 88 | + needs: build |
| 89 | + runs-on: ubuntu-latest |
| 90 | + permissions: |
| 91 | + contents: write |
| 92 | + |
| 93 | + steps: |
| 94 | + - name: Checkout code |
| 95 | + uses: actions/checkout@v4 |
| 96 | + |
| 97 | + - name: Download all artifacts |
| 98 | + uses: actions/download-artifact@v4 |
| 99 | + with: |
| 100 | + path: artifacts |
| 101 | + |
| 102 | + - name: Display structure of downloaded files |
| 103 | + run: ls -R artifacts |
| 104 | + |
| 105 | + - name: Get version from package.json |
| 106 | + id: package-version |
| 107 | + run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT |
| 108 | + |
| 109 | + - name: Create Draft Release |
| 110 | + uses: softprops/action-gh-release@v2 |
| 111 | + with: |
| 112 | + draft: true |
| 113 | + prerelease: false |
| 114 | + name: Release v${{ steps.package-version.outputs.version }} |
| 115 | + tag_name: ${{ github.ref_name }} |
| 116 | + generate_release_notes: true |
| 117 | + files: | |
| 118 | + artifacts/**/* |
| 119 | + env: |
| 120 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments