From 7dae26ffb4f08e7a0a679b80f22a1cd09c5bd661 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E5=A8=87?=
Date: Tue, 27 Feb 2024 14:02:34 +0800
Subject: [PATCH] macos dmg build
---
.github/workflows/main.yml | 28 ++++++++++++++++++++++++++++
dmg/config.json | 8 ++++++++
2 files changed, 36 insertions(+)
create mode 100644 dmg/config.json
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index f7d54e1..98e81c4 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -31,3 +31,31 @@ jobs:
name: Renamer-${{github.ref_name}}-windows.zip
path: build/windows/x64/runner/Release
+ build-and-release-macos:
+ runs-on: macos-latest
+
+ steps:
+ - uses: actions/checkout@v4
+ - uses: subosito/flutter-action@v2
+ with:
+ channel: 'stable'
+ architecture: x64
+ flutter-version: '3.19.1'
+ - name: Install project dependencies
+ run: flutter pub get
+ - name: Enable macOS build
+ run: flutter config --enable-macos-desktop
+ - name: Build artifacts
+ run: flutter build macos --release
+ - name: install npm
+ run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
+ - name: install appdmg
+ run: npm install -g appdmg
+ - name: build dmg
+ run: appdmg ./dmg/config.json ./build/macos/Build/Products/Release/
+ - name: macOS Release
+ uses: actions/upload-artifact@v4
+ with:
+ name: Renamer-${{github.ref_name}}-macos.zip
+ path: build/macos/Build/Products/Release
+
diff --git a/dmg/config.json b/dmg/config.json
new file mode 100644
index 0000000..d38d089
--- /dev/null
+++ b/dmg/config.json
@@ -0,0 +1,8 @@
+{
+ "title": "Renamer",
+ "icon": "./assets/desktop.png",
+ "contents": [
+ { "x": 448, "y": 344, "type": "link", "path": "/Applications" },
+ { "x": 192, "y": 344, "type": "file", "path": "./build/macos/Build/Products/Release/APP_NAME.app" }
+ ]
+}
\ No newline at end of file