Build & Release #26
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 & Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Version tag (e.g. v1.1.2)" | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| arch: x64 | |
| platform: win | |
| builder-flags: --win --x64 | |
| artifact-name: 68HUB-win-x64 | |
| ext: .exe | |
| - os: macos-15 | |
| arch: arm64 | |
| platform: mac | |
| builder-flags: --mac --arm64 | |
| artifact-name: 68HUB-mac-arm64 | |
| ext: .dmg | |
| - os: macos-15-intel | |
| arch: x64 | |
| platform: mac | |
| builder-flags: --mac --x64 | |
| artifact-name: 68HUB-mac-x64 | |
| ext: .dmg | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm build | |
| - name: Rebuild native modules | |
| run: | | |
| node -e "require('fs').rmSync('node_modules/better-sqlite3/build', { recursive: true, force: true })" | |
| npx electron-rebuild -f -w better-sqlite3 --arch ${{ matrix.arch }} | |
| - name: Verify native module architecture | |
| shell: bash | |
| run: | | |
| native_info="$(file node_modules/better-sqlite3/build/Release/better_sqlite3.node)" | |
| echo "$native_info" | |
| case "${{ matrix.platform }}:${{ matrix.arch }}" in | |
| win:x64) | |
| case "$native_info" in | |
| *x86-64*) ;; | |
| *) echo "Expected x86-64 Windows native module" >&2; exit 1 ;; | |
| esac | |
| ;; | |
| mac:x64) | |
| case "$native_info" in | |
| *x86_64*) ;; | |
| *) echo "Expected x86_64 macOS native module" >&2; exit 1 ;; | |
| esac | |
| ;; | |
| mac:arm64) | |
| case "$native_info" in | |
| *arm64*) ;; | |
| *) echo "Expected arm64 macOS native module" >&2; exit 1 ;; | |
| esac | |
| ;; | |
| esac | |
| - name: Package | |
| run: npx --yes electron-builder@25 ${{ matrix.builder-flags }} --publish never | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact-name }} | |
| path: release/*${{ matrix.ext }} | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Generate checksums | |
| run: find artifacts -type f -exec sha256sum {} \; > checksums.txt | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ inputs.tag }} | |
| name: ${{ inputs.tag }} | |
| body_path: CHANGELOG.md | |
| files: | | |
| artifacts/**/* | |
| checksums.txt |