diff --git a/.github/workflows/flutter_desktop_ci.yml b/.github/workflows/flutter_desktop_ci.yml new file mode 100644 index 0000000..72feef6 --- /dev/null +++ b/.github/workflows/flutter_desktop_ci.yml @@ -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/flutter-action@v2.6.1 + 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 \ No newline at end of file diff --git a/assets/focusmate_installer.icns b/assets/focusmate_installer.icns new file mode 100644 index 0000000..94cf291 Binary files /dev/null and b/assets/focusmate_installer.icns differ diff --git a/scripts/create_dmg.sh b/scripts/create_dmg.sh new file mode 100755 index 0000000..42878b0 --- /dev/null +++ b/scripts/create_dmg.sh @@ -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" \ No newline at end of file