Skip to content

docs: README.md: update title #1

docs: README.md: update title

docs: README.md: update title #1

name: Desktop Release
on:
push:
tags:
- 'v*'
- 'desktop-v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 0.3.0)'
required: true
type: string
env:
APP_NAME: PlexusOne Desktop
BUNDLE_ID: com.plexusone.desktop
jobs:
build-macos:
name: Build macOS
runs-on: macos-14
strategy:
matrix:
include:
- arch: arm64
target: arm64-apple-macosx
- arch: x86_64
target: x86_64-apple-macosx
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Swift
uses: swift-actions/setup-swift@v2
with:
swift-version: '5.9'
- name: Get version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
else
# Extract version from tag (v0.3.0 -> 0.3.0)
VERSION="${GITHUB_REF_NAME#v}"
VERSION="${VERSION#desktop-v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
fi
- name: Build release binary
working-directory: apps/desktop
run: |
swift build -c release --arch ${{ matrix.arch }}
- name: Create app bundle
working-directory: apps/desktop
run: |
APP_DIR="${{ env.APP_NAME }}.app"
mkdir -p "$APP_DIR/Contents/MacOS"
mkdir -p "$APP_DIR/Contents/Resources"
# Copy binary
cp ".build/${{ matrix.target }}/release/PlexusOneDesktop" "$APP_DIR/Contents/MacOS/"
# Copy Info.plist and update version
cp Sources/PlexusOneDesktop/Info.plist "$APP_DIR/Contents/"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${{ steps.version.outputs.version }}" "$APP_DIR/Contents/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${{ steps.version.outputs.version }}" "$APP_DIR/Contents/Info.plist"
# Copy icon if exists
if [ -f "Sources/PlexusOneDesktop/Resources/AppIcon.icns" ]; then
cp Sources/PlexusOneDesktop/Resources/AppIcon.icns "$APP_DIR/Contents/Resources/"
fi
- name: Create DMG
working-directory: apps/desktop
run: |
# Install create-dmg
brew install create-dmg || true
DMG_NAME="PlexusOneDesktop-${{ steps.version.outputs.version }}-macos-${{ matrix.arch }}.dmg"
# Create DMG
create-dmg \
--volname "${{ env.APP_NAME }}" \
--volicon "Sources/PlexusOneDesktop/Resources/AppIcon.icns" \
--window-pos 200 120 \
--window-size 600 400 \
--icon-size 100 \
--icon "${{ env.APP_NAME }}.app" 150 190 \
--app-drop-link 450 185 \
"$DMG_NAME" \
"${{ env.APP_NAME }}.app" || \
# Fallback to hdiutil if create-dmg fails
hdiutil create -volname "${{ env.APP_NAME }}" -srcfolder "${{ env.APP_NAME }}.app" -ov -format UDZO "$DMG_NAME"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PlexusOneDesktop-macos-${{ matrix.arch }}
path: apps/desktop/PlexusOneDesktop-*.dmg
build-universal:
name: Build macOS Universal
runs-on: macos-14
needs: []
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Swift
uses: swift-actions/setup-swift@v2
with:
swift-version: '5.9'
- name: Get version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
else
VERSION="${GITHUB_REF_NAME#v}"
VERSION="${VERSION#desktop-v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
fi
- name: Build universal binary
working-directory: apps/desktop
run: |
# Build for both architectures
swift build -c release --arch arm64
swift build -c release --arch x86_64
# Create universal binary with lipo
mkdir -p .build/universal/release
lipo -create \
.build/arm64-apple-macosx/release/PlexusOneDesktop \
.build/x86_64-apple-macosx/release/PlexusOneDesktop \
-output .build/universal/release/PlexusOneDesktop
- name: Create app bundle
working-directory: apps/desktop
run: |
APP_DIR="${{ env.APP_NAME }}.app"
mkdir -p "$APP_DIR/Contents/MacOS"
mkdir -p "$APP_DIR/Contents/Resources"
# Copy universal binary
cp .build/universal/release/PlexusOneDesktop "$APP_DIR/Contents/MacOS/"
# Copy Info.plist and update version
cp Sources/PlexusOneDesktop/Info.plist "$APP_DIR/Contents/"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${{ steps.version.outputs.version }}" "$APP_DIR/Contents/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${{ steps.version.outputs.version }}" "$APP_DIR/Contents/Info.plist"
# Copy icon if exists
if [ -f "Sources/PlexusOneDesktop/Resources/AppIcon.icns" ]; then
cp Sources/PlexusOneDesktop/Resources/AppIcon.icns "$APP_DIR/Contents/Resources/"
fi
- name: Create DMG
working-directory: apps/desktop
run: |
brew install create-dmg || true
DMG_NAME="PlexusOneDesktop-${{ steps.version.outputs.version }}-macos-universal.dmg"
create-dmg \
--volname "${{ env.APP_NAME }}" \
--volicon "Sources/PlexusOneDesktop/Resources/AppIcon.icns" \
--window-pos 200 120 \
--window-size 600 400 \
--icon-size 100 \
--icon "${{ env.APP_NAME }}.app" 150 190 \
--app-drop-link 450 185 \
"$DMG_NAME" \
"${{ env.APP_NAME }}.app" || \
hdiutil create -volname "${{ env.APP_NAME }}" -srcfolder "${{ env.APP_NAME }}.app" -ov -format UDZO "$DMG_NAME"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PlexusOneDesktop-macos-universal
path: apps/desktop/PlexusOneDesktop-*.dmg
release:
name: Create Release
runs-on: ubuntu-latest
needs: [build-macos, build-universal]
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Get version
id: version
run: |
VERSION="${GITHUB_REF_NAME#v}"
VERSION="${VERSION#desktop-v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: PlexusOne Desktop v${{ steps.version.outputs.version }}
draft: false
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
generate_release_notes: true
files: |
artifacts/**/*.dmg