|
| 1 | +permissions: |
| 2 | + contents: write |
| 3 | +name: Build/release |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - "main" |
| 9 | + - "releases/**" |
| 10 | + tags: |
| 11 | + - "v*" |
| 12 | + |
| 13 | +jobs: |
| 14 | + release: |
| 15 | + runs-on: ${{ matrix.os }} |
| 16 | + strategy: |
| 17 | + max-parallel: 1 |
| 18 | + matrix: |
| 19 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Check out Git repository |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Install Node.js and NPM |
| 26 | + uses: actions/setup-node@v4 |
| 27 | + with: |
| 28 | + node-version: 22.14 |
| 29 | + cache: "npm" |
| 30 | + |
| 31 | + - name: Install dependencies |
| 32 | + run: npm ci |
| 33 | + |
| 34 | + # TODO: Figure out how to gen windows cert again... wrote an article on this somewhere, where? hm... |
| 35 | + # - name: Decode certificate (Windows only) |
| 36 | + # if: matrix.os == 'windows-latest' |
| 37 | + # run: | |
| 38 | + # $bytes = [Convert]::FromBase64String("${{ secrets.WINDOWS_CERTIFICATE }}") |
| 39 | + # [IO.File]::WriteAllBytes("$env:RUNNER_TEMP\cert.pfx", $bytes) |
| 40 | + # shell: pwsh |
| 41 | + |
| 42 | + # - name: Build Electron app (Windows) |
| 43 | + # if: matrix.os == 'windows-latest' |
| 44 | + # env: |
| 45 | + # WINDOWS_CERTIFICATE_FILE: ${{ runner.temp }}\cert.pfx |
| 46 | + # WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }} |
| 47 | + # run: npm run make --workspace packages/desktop |
| 48 | + |
| 49 | + - name: Build Electron app |
| 50 | + if: ${{ !startsWith(github.ref, 'refs/tags/v') }} |
| 51 | + run: npm run make --workspace packages/desktop |
| 52 | + |
| 53 | + - name: Publish draft release |
| 54 | + if: startsWith(github.ref, 'refs/tags/v') |
| 55 | + run: npm run publish --workspace packages/desktop |
| 56 | + env: |
| 57 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 58 | + |
| 59 | + - name: Upload artifacts |
| 60 | + uses: actions/upload-artifact@v4 |
| 61 | + with: |
| 62 | + name: ${{ matrix.os }}-artifacts |
| 63 | + path: | |
| 64 | + packages/desktop/out/make/**/* |
0 commit comments