Skip to content

refactor: annotate copyToClipboard method with @MainActor for thread … #18

refactor: annotate copyToClipboard method with @MainActor for thread …

refactor: annotate copyToClipboard method with @MainActor for thread … #18

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build-macos:
name: Build macOS Universal Binary
runs-on: macos-14 # Apple Silicon runner for faster arm64 builds
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Extract version from tag
id: version
env:
REF_TYPE: ${{ github.ref_type }}
REF_NAME: ${{ github.ref }}
SHA: ${{ github.sha }}
run: |
if [ "$REF_TYPE" = "tag" ]; then
VERSION=${REF_NAME#refs/tags/v}
else
VERSION="dev-${SHA::7}"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Version: ${VERSION}"
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin,x86_64-apple-darwin
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: flow-core
- name: Build Rust library for Apple Silicon (aarch64)
run: |
cd flow-core
cargo build --release --target aarch64-apple-darwin
ls -lh target/aarch64-apple-darwin/release/libflow.a
- name: Build Rust library for Intel (x86_64)
run: |
cd flow-core
cargo build --release --target x86_64-apple-darwin
ls -lh target/x86_64-apple-darwin/release/libflow.a
- name: Create universal Rust library
run: |
cd flow-core
mkdir -p target/release
lipo -create \
target/aarch64-apple-darwin/release/libflow.a \
target/x86_64-apple-darwin/release/libflow.a \
-output target/release/libflow.a
echo "Universal library created:"
lipo -info target/release/libflow.a
ls -lh target/release/libflow.a
- name: Build Swift for Apple Silicon (arm64)
run: |
swift build -c release --arch arm64
cp .build/arm64-apple-macosx/release/Flow .build/Flow-arm64
- name: Build Swift for Intel (x86_64)
run: |
swift build -c release --arch x86_64
cp .build/x86_64-apple-macosx/release/Flow .build/Flow-x86_64
- name: Create Swift universal binary
run: |
lipo -create .build/Flow-arm64 .build/Flow-x86_64 -output .build/Flow
echo "Universal binary created:"
lipo -info .build/Flow
- name: Verify universal binary
run: |
lipo -info .build/Flow
- name: Create .app bundle structure
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
APP_NAME="Flow"
APP_BUNDLE="${APP_NAME}.app"
BUNDLE_ID="com.flow.flow"
# Create bundle directories
mkdir -p "${APP_BUNDLE}/Contents/MacOS"
mkdir -p "${APP_BUNDLE}/Contents/Resources"
# Copy executable
cp .build/Flow "${APP_BUNDLE}/Contents/MacOS/Flow"
chmod +x "${APP_BUNDLE}/Contents/MacOS/Flow"
# Copy resources
if [ -f "menubar.svg" ]; then
cp menubar.svg "${APP_BUNDLE}/Contents/Resources/"
fi
if [ -f "AppIcon.icns" ]; then
cp AppIcon.icns "${APP_BUNDLE}/Contents/Resources/"
fi
# Create Info.plist
cat > "${APP_BUNDLE}/Contents/Info.plist" << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>Flow</string>
<key>CFBundleIdentifier</key>
<string>${BUNDLE_ID}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${APP_NAME}</string>
<key>CFBundleIconFile</key>
<string>AppIcon</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${VERSION}</string>
<key>CFBundleVersion</key>
<string>${VERSION}</string>
<key>LSMinimumSystemVersion</key>
<string>14.0</string>
<key>LSUIElement</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2025</string>
</dict>
</plist>
EOF
echo "App bundle created:"
ls -lah "${APP_BUNDLE}/Contents/MacOS/"
ls -lah "${APP_BUNDLE}/Contents/Resources/" || true
- name: Ad-hoc sign app bundle
run: |
APP_NAME="Flow"
codesign --force --deep --sign - "${APP_NAME}.app"
xattr -rc "${APP_NAME}.app"
codesign -dv --verbose=4 "${APP_NAME}.app" || true
- name: Build .dmg installer
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
APP_NAME="Flow"
DMG_NAME="Flow-macOS-universal.dmg"
hdiutil create \
-volname "${APP_NAME}" \
-srcfolder "${APP_NAME}.app" \
-ov \
-format UDZO \
"${DMG_NAME}"
echo "DMG created:"
ls -lh "${DMG_NAME}"
# Store dmg name for later steps
echo "dmg_name=${DMG_NAME}" >> $GITHUB_ENV
- name: Generate checksum
run: |
shasum -a 256 "${{ env.dmg_name }}" > "${{ env.dmg_name }}.sha256"
cat "${{ env.dmg_name }}.sha256"
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{ env.dmg_name }}
${{ env.dmg_name }}.sha256
draft: false
generate_release_notes: true
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact for manual workflow runs
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: Flow-macOS-universal
path: |
${{ env.dmg_name }}
${{ env.dmg_name }}.sha256
retention-days: 7