From 5e6cde36afdf7e092086dee235a38df9c9790923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=85=B1=E5=A4=A9=E5=B0=8F=E7=A6=BD=E5=85=BD?= Date: Wed, 22 Mar 2023 18:40:46 +0800 Subject: [PATCH] =?UTF-8?q?Distribute=20.dmg=20file=20for=20macOS=20macOS?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E5=8C=85=E6=A0=BC=E5=BC=8F=E6=94=B9=E4=B8=BA?= =?UTF-8?q?.dmg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_publish.yml | 4 ++-- changelog/v6.6.6+123.md | 4 ++-- dmg.sh | 7 ++----- pkg.sh | 8 ++++++++ 4 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 pkg.sh diff --git a/.github/workflows/build_publish.yml b/.github/workflows/build_publish.yml index a188c504..df08c4a4 100644 --- a/.github/workflows/build_publish.yml +++ b/.github/workflows/build_publish.yml @@ -44,7 +44,7 @@ jobs: cache_pod_path: macos/Pods cache_pod_restore_keys_hash_file: macos/Podfile.lock artifact_name: release-macOS - artifact_path: build/macos/*.pkg + artifact_path: /Users/runner/work/JHenTai/JHenTai/*.dmg outputs: version: ${{ steps.get_version.outputs.version }} runs-on: ${{ matrix.os }} @@ -122,7 +122,7 @@ jobs: mkdir -p Payload mv ios/iphoneos/*.app Payload zip -9 JHenTai_${{ steps.get_version.outputs.version }}.ipa -r Payload - # Build macOS .zip + # Build macOS .dmg - name: Build macOS if: matrix.target == 'macOS' run: | diff --git a/changelog/v6.6.6+123.md b/changelog/v6.6.6+123.md index 656cf303..9279114a 100644 --- a/changelog/v6.6.6+123.md +++ b/changelog/v6.6.6+123.md @@ -1,5 +1,5 @@ -1. macOS安装包格式改为.pkg +1. macOS安装包格式改为.dmg ------------------------------------------------------------------------------------------ -1. Distribute .pkg file for macOS +1. Distribute .dmg file for macOS diff --git a/dmg.sh b/dmg.sh index c1c10e84..6b14526c 100644 --- a/dmg.sh +++ b/dmg.sh @@ -1,8 +1,5 @@ version=$(head -n 5 pubspec.yaml | tail -n 1 | cut -d ' ' -f 2) flutter build macos --release -t lib/src/main.dart \ -&& hdiutil create -size 150m -fs HFS+ -volname JHenTai JHenTai.dmg \ -&& hdiutil attach JHenTai.dmg \ -&& cp -R build/macos/Build/Products/Release/jhentai.app /Volumes/JHenTai \ -&& pkgbuild --install-location /Applications/JHenTai.app --identifier top.jtmonster.jhentai --version ${version} --root /Volumes/JHenTai/jhentai.app build/macos/JHenTai-${version}.pkg \ -&& hdiutil detach /Volumes/JHenTai +&& brew install create-dmg \ +&& create-dmg --volname JHenTai-${version} --window-pos 200 120 --window-size 800 450 --icon-size 100 --app-drop-link 600 185 JHenTai-${version}.dmg build/macos/Build/Products/Release/jhentai.app \ No newline at end of file diff --git a/pkg.sh b/pkg.sh new file mode 100644 index 00000000..c1c10e84 --- /dev/null +++ b/pkg.sh @@ -0,0 +1,8 @@ +version=$(head -n 5 pubspec.yaml | tail -n 1 | cut -d ' ' -f 2) + +flutter build macos --release -t lib/src/main.dart \ +&& hdiutil create -size 150m -fs HFS+ -volname JHenTai JHenTai.dmg \ +&& hdiutil attach JHenTai.dmg \ +&& cp -R build/macos/Build/Products/Release/jhentai.app /Volumes/JHenTai \ +&& pkgbuild --install-location /Applications/JHenTai.app --identifier top.jtmonster.jhentai --version ${version} --root /Volumes/JHenTai/jhentai.app build/macos/JHenTai-${version}.pkg \ +&& hdiutil detach /Volumes/JHenTai