Skip to content

Commit

Permalink
CI: Add worflow for desktop builds
Browse files Browse the repository at this point in the history
  • Loading branch information
rkishan516 committed Oct 22, 2024
1 parent 0683af2 commit 27fac1d
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/flutter_desktop_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Flutter Desktop CI

on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: write

jobs:
build-macos:
name: "Build MacOS"
runs-on: macos-latest

steps:
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v4

# Step 2: Set up Flutter environment
- name: Set up Flutter
uses: subosito/[email protected]
with:
channel: stable
cache: true
- name: Set Up XCode
uses: BoundfoxStudios/action-xcode-select@v1

# Step 3: Install dependencies
- name: Install dependencies
run: flutter pub get

# Step 4: Build the Flutter app for desktop
- name: Build Desktop App
run: flutter build macos --build-number=${{ github.run_number }}
- name: Install create-dmg
run: brew install create-dmg
- name: Create dmg
run: |
chmod +x scripts/create_dmg.sh
./scripts/create_dmg.sh
- name: Compress artifacts
run: zip -r macos-dev.zip build/macos/Build/Products/Release

# Step 5: Upload build artifacts
- name: Upload Build DMG
uses: actions/upload-artifact@v4
with:
name: focusmate-macos-dev.dmg
path: build/macos/Build/Products/Release/FocusMate.dmg
- name: Upload Build Zip
uses: actions/upload-artifact@v4
with:
name: focusmate-macos-dev.zip
path: macos-dev.zip

# Step 6: Create Release
- name: release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: v1.0.0-${{ github.run_number }}
name: "Release ${{ github.run_number }}"
draft: false
prerelease: false
artifacts: |
build/macos/Build/Products/Release/FocusMate.dmg
macos-dev.zip
artifact_content_type: |
application/x-apple-diskimage
application/zip
Binary file added assets/focusmate_installer.icns
Binary file not shown.
15 changes: 15 additions & 0 deletions scripts/create_dmg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
test -f focusmate.dmg && rm focusmate.dmg
create-dmg \
--volname "FocusMate Installer" \
--volicon "./assets/focusmate_installer.icns" \
--window-pos 200 120 \
--window-size 800 530 \
--icon-size 130 \
--text-size 14 \
--icon "focus_mate.app" 260 250 \
--hide-extension "focus_mate.app" \
--app-drop-link 540 250 \
--hdiutil-quiet \
"build/macos/Build/Products/Release/FocusMate.dmg" \
"build/macos/Build/Products/Release/focus_mate.app"

0 comments on commit 27fac1d

Please sign in to comment.