Build and Release #20
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 Electron App | |
| on: | |
| push: | |
| tags: ['v*'] | |
| workflow_dispatch: {} | |
| permissions: | |
| contents: write | |
| packages: write | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| jobs: | |
| build-macos: | |
| runs-on: macos-15 | |
| strategy: | |
| matrix: | |
| arch: [x64, arm64] | |
| include: | |
| - arch: x64 | |
| platform: mac-x64 | |
| - arch: arm64 | |
| platform: mac-arm64 | |
| env: | |
| CSC_LINK: ${{ secrets.SNAPMIND_CSC_LINK }} | |
| CSC_KEY_PASSWORD: ${{ secrets.SNAPMIND_CSC_KEY_PASSWORD }} | |
| steps: | |
| - 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 macOS helper | |
| run: | | |
| if [ "${{ matrix.arch }}" = "arm64" ]; then | |
| bash ./build-macos-helper.sh --arm64 | |
| else | |
| bash ./build-macos-helper.sh --x64 | |
| fi | |
| - name: Build app | |
| run: npm run build | |
| - name: Build electron app (per-arch) | |
| run: | | |
| if [ "${{ matrix.arch }}" = "arm64" ]; then | |
| npx electron-builder --mac --arm64 | |
| else | |
| npx electron-builder --mac --x64 | |
| fi | |
| - name: Upload macOS artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-artifacts-${{ matrix.arch }} | |
| path: | | |
| build/*.dmg | |
| build/*.zip | |
| retention-days: 1 | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build Windows helper | |
| run: npm run build:win-helper | |
| - name: Build app | |
| run: npm run build | |
| - name: Build electron app | |
| run: npx electron-builder --win --x64 --config electron-builder-win.json | |
| - name: List build contents | |
| run: Get-ChildItem -Path build | Format-Table Name, Length | |
| - name: Upload Windows artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-artifacts | |
| path: | | |
| build/*.exe | |
| build/*.zip | |
| build/*.7z | |
| retention-days: 1 | |
| create-release: | |
| needs: [build-macos, build-windows] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| macos-artifacts-*/**/*.dmg | |
| macos-artifacts-*/**/*.zip | |
| windows-artifacts/*.exe | |
| windows-artifacts/*.zip | |
| windows-artifacts/*.7z | |
| draft: true | |
| generate_release_notes: true |