- remove manual `arch` workflow input and build `arm64` + `x64` via matrix - split release flow into `build-macos` and `publish-release` jobs - download merged artifacts before creating the GitHub release
124 lines
3.8 KiB
YAML
124 lines
3.8 KiB
YAML
name: Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: "Git tag to create/use for this release (example: v0.1.0)"
|
|
required: true
|
|
type: string
|
|
release_name:
|
|
description: "Display name for the GitHub release"
|
|
required: false
|
|
type: string
|
|
version:
|
|
description: "Semver version injected into packaged artifacts (example: 0.1.0)"
|
|
required: true
|
|
type: string
|
|
draft:
|
|
description: "Create release as draft"
|
|
required: true
|
|
default: true
|
|
type: boolean
|
|
prerelease:
|
|
description: "Mark release as pre-release"
|
|
required: true
|
|
default: true
|
|
type: boolean
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
concurrency:
|
|
group: release-${{ inputs.tag }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
build-macos:
|
|
name: Build and package macOS (${{ matrix.arch }})
|
|
runs-on: macos-14
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
arch:
|
|
- arm64
|
|
- x64
|
|
env:
|
|
CI: "true"
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version-file: package.json
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: package.json
|
|
|
|
- name: Cache Bun and Turbo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.bun/install/cache
|
|
.turbo
|
|
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}-${{ hashFiles('turbo.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}-
|
|
|
|
- name: Install dependencies
|
|
run: bun install --frozen-lockfile
|
|
|
|
- name: Build and package macOS artifact
|
|
run: |
|
|
bun run dist:desktop:dmg -- --arch "${{ matrix.arch }}" --version "${{ inputs.version }}"
|
|
ls -lah release
|
|
# TODO: Add production macOS signing and notarization in CI:
|
|
# - Import Developer ID Application certificate + private key into keychain.
|
|
# - Provide APPLE_ID / APPLE_TEAM_ID / APPLE_APP_SPECIFIC_PASSWORD secrets.
|
|
# - Build with signing enabled and notarize + staple before release upload.
|
|
|
|
- name: Generate SHA256 checksums
|
|
run: |
|
|
find release -maxdepth 1 -type f ! -name "SHA256SUMS.txt" -print0 \
|
|
| xargs -0 shasum -a 256 > release/SHA256SUMS.txt
|
|
cat release/SHA256SUMS.txt
|
|
|
|
- name: Upload packaged artifacts to workflow run
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: release-assets-${{ inputs.tag }}-${{ matrix.arch }}
|
|
path: release/*
|
|
if-no-files-found: error
|
|
|
|
publish-release:
|
|
name: Create GitHub release
|
|
runs-on: ubuntu-latest
|
|
needs: build-macos
|
|
steps:
|
|
- name: Download packaged artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
pattern: release-assets-${{ inputs.tag }}-*
|
|
merge-multiple: true
|
|
path: release-assets
|
|
|
|
- name: Create GitHub release and upload assets
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ inputs.tag }}
|
|
name: ${{ inputs.release_name != '' && inputs.release_name || inputs.tag }}
|
|
draft: ${{ inputs.draft }}
|
|
prerelease: ${{ inputs.prerelease }}
|
|
generate_release_notes: true
|
|
files: release-assets/*
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
# TODO: Add a multi-platform release matrix and publish Linux/Windows installers:
|
|
# - Linux: build/sign AppImage/deb/rpm artifacts on ubuntu runners.
|
|
# - Windows: build/sign MSI/NSIS artifacts on windows runners.
|
|
# - Consider per-platform updater metadata/signature publishing strategy.
|