Build & Release #11
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: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Version tag (e.g. v1.1.1)" | |
| 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: windows-latest | |
| arch: ia32 | |
| platform: win | |
| builder-flags: --win --ia32 | |
| artifact-name: 68HUB-win-ia32 | |
| ext: .exe | |
| - os: macos-13 | |
| arch: x64 | |
| platform: mac | |
| builder-flags: --mac --x64 | |
| artifact-name: 68HUB-mac-x64 | |
| ext: .dmg | |
| - os: macos-latest | |
| arch: arm64 | |
| platform: mac | |
| builder-flags: --mac --arm64 | |
| artifact-name: 68HUB-mac-arm64 | |
| ext: .dmg | |
| - os: ubuntu-latest | |
| arch: x64 | |
| platform: linux | |
| builder-flags: --linux --x64 | |
| artifact-name: 68HUB-linux-x64 | |
| ext: .AppImage | |
| 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: npx electron-rebuild -f -w better-sqlite3 ${{ matrix.arch != 'x64' && format('--arch {0}', matrix.arch) || '' }} | |
| - 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: Determine tag | |
| id: tag | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| echo "name=${{ inputs.tag }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "name=${{ github.ref_name }}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.tag.outputs.name }} | |
| name: ${{ steps.tag.outputs.name }} | |
| body_path: CHANGELOG.md | |
| files: | | |
| artifacts/**/* | |
| checksums.txt |