ci: add bun macos arm64 dmg build
This commit is contained in:
@@ -0,0 +1,151 @@
|
||||
name: Build macOS ARM64 DMG (Bun)
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
upload_to_release:
|
||||
description: "Upload DMG to an existing GitHub release/tag"
|
||||
required: false
|
||||
default: "false"
|
||||
type: choice
|
||||
options:
|
||||
- "false"
|
||||
- "true"
|
||||
tag_name:
|
||||
description: "Release tag to upload to when upload_to_release=true"
|
||||
required: false
|
||||
default: ""
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- ".github/workflows/build-macos-arm64-dmg-bun.yml"
|
||||
- "desktop/**"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
env:
|
||||
CARGO_INCREMENTAL: 0
|
||||
RUST_BACKTRACE: short
|
||||
NODE_OPTIONS: "--max_old_space_size=4096"
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: desktop
|
||||
|
||||
concurrency:
|
||||
group: "${{ github.workflow }}-${{ github.ref }}"
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-macos-arm64-dmg:
|
||||
name: Build DMG (aarch64-apple-darwin)
|
||||
runs-on: macos-14
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: aarch64-apple-darwin
|
||||
|
||||
- name: Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
prefix-key: "v1"
|
||||
key: "macos-14-aarch64-apple-darwin-bun-dmg"
|
||||
workspaces: desktop/src-tauri -> target
|
||||
|
||||
- name: Install Protoc
|
||||
uses: arduino/setup-protoc@v3
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
|
||||
# The client has local `link:` dependencies. Bun 1.3 cannot install those
|
||||
# from the existing pnpm lockfile yet, so pnpm remains the install/link
|
||||
# layer while Bun drives the final build command.
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
run_install: false
|
||||
|
||||
- name: Get linked dependency versions
|
||||
id: dep-versions
|
||||
shell: bash
|
||||
run: |
|
||||
SM_SHA=$(git -C libs/stream-monaco rev-parse HEAD)
|
||||
MS_SHA=$(git -C libs/markstream-vue rev-parse HEAD)
|
||||
echo "cache-key=${{ runner.os }}-aarch64-apple-darwin-bun-linked-deps-${SM_SHA:0:12}-${MS_SHA:0:12}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Cache linked dependencies
|
||||
id: cache-linked-deps
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
desktop/libs/stream-monaco/node_modules
|
||||
desktop/libs/stream-monaco/dist
|
||||
desktop/libs/markstream-vue/node_modules
|
||||
desktop/libs/markstream-vue/packages/markdown-parser/node_modules
|
||||
desktop/libs/markstream-vue/packages/markdown-parser/dist
|
||||
desktop/libs/markstream-vue/packages/markstream-react/node_modules
|
||||
desktop/libs/markstream-vue/packages/markstream-react/dist
|
||||
key: ${{ steps.dep-versions.outputs.cache-key }}
|
||||
|
||||
- name: Build linked dependencies
|
||||
if: steps.cache-linked-deps.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
pnpm --dir libs/stream-monaco install --frozen-lockfile
|
||||
pnpm --dir libs/stream-monaco build
|
||||
|
||||
pnpm --dir libs/markstream-vue install --frozen-lockfile
|
||||
pnpm --dir libs/markstream-vue run build:parser
|
||||
pnpm --dir libs/markstream-vue/packages/markstream-react build
|
||||
|
||||
- name: Install client dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build macOS ARM64 DMG with Bun
|
||||
env:
|
||||
APPLE_SIGNING_IDENTITY: "-"
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
||||
run: |
|
||||
bun run tauri build --target aarch64-apple-darwin --bundles dmg
|
||||
|
||||
- name: Collect DMG
|
||||
id: collect
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p dist/macos-arm64
|
||||
shopt -s nullglob
|
||||
files=(src-tauri/target/aarch64-apple-darwin/release/bundle/dmg/*.dmg)
|
||||
if (( ${#files[@]} == 0 )); then
|
||||
echo "No DMG found under src-tauri/target/aarch64-apple-darwin/release/bundle/dmg" >&2
|
||||
exit 1
|
||||
fi
|
||||
for file in "${files[@]}"; do
|
||||
cp "$file" "dist/macos-arm64/"
|
||||
done
|
||||
echo "dmg-path=dist/macos-arm64" >> "$GITHUB_OUTPUT"
|
||||
ls -lh dist/macos-arm64
|
||||
|
||||
- name: Upload DMG artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: BoosAPI-Desktop-macos-arm64-dmg
|
||||
path: desktop/dist/macos-arm64/*.dmg
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload DMG to release
|
||||
if: ${{ inputs.upload_to_release == 'true' && inputs.tag_name != '' }}
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ inputs.tag_name }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
files: desktop/dist/macos-arm64/*.dmg
|
||||
Reference in New Issue
Block a user