Skip to content

Commit

Permalink
更换mac dmg打包方式
Browse files Browse the repository at this point in the history
不使用node系的工具,改用原生自带的hdiutil,
  • Loading branch information
AoEiuV020 committed Dec 25, 2024
1 parent 5e3649d commit 8404c35
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,21 +233,22 @@ jobs:
path: ${{ matrix.RELEASE_PATH }}
directory: ${{ matrix.RELEASE_DIRECTORY }}
filename: ${{ github.workspace }}/build/${{ env.BUILD_NAME_WITH_VERSION }}-${{ matrix.name }}.${{ matrix.FILE_TYPE }}
- name: set python version
if: "${{ matrix.FILE_TYPE == 'dmg' }}"
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: dmg
if: "${{ matrix.FILE_TYPE == 'dmg' }}"
run: |
npm install -g appdmg
appPath=$(ls -d ${{ matrix.RELEASE_DIRECTORY }}/${{ matrix.RELEASE_PATH }})
echo '{"title":"###TITLE###","icon":"###PATH###/Contents/Resources/AppIcon.icns","contents":[{"x":448,"y":144,"type":"link","path":"/Applications"},{"x":192,"y":144,"type":"file","path":"###PATH###"}]}' |
sed "s/###TITLE###/${{ env.BUILD_NAME }}/g" |
sed "s/###PATH###/$(echo $appPath | sed 's_/_\\/_g')/g" |
tee ./appdmg.json
appdmg ./appdmg.json build/${{ env.BUILD_NAME_WITH_VERSION }}-${{ matrix.name }}.${{ matrix.FILE_TYPE }}
cd build
# 创建临时目录
mkdir -p dist
# 复制 app 到临时目录
cp -r "$appPath" dist/
# 创建 Applications 软链接
ln -s /Applications dist/Applications
# 使用 hdiutil 创建 dmg
hdiutil create -volname "${{ env.BUILD_NAME }}" \
-srcfolder dist \
-format UDZO \
"${{ env.BUILD_NAME_WITH_VERSION }}-${{ matrix.name }}.${{ matrix.FILE_TYPE }}"
- name: copy file
if: "${{ matrix.FILE_TYPE == 'apk' || matrix.FILE_TYPE == 'aab' }}"
run: cp ${{ matrix.RELEASE_DIRECTORY }}/${{ matrix.RELEASE_PATH }} build/${{ env.BUILD_NAME_WITH_VERSION }}-${{ matrix.name }}.${{ matrix.FILE_TYPE }}
Expand Down

0 comments on commit 8404c35

Please sign in to comment.