Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,30 +60,24 @@ jobs:
sudo apt-get install fuse
- name: Build-MacOsApp
run: |
cd ./PCL.Neo
sudo su
dotnet restore -r osx-x64
dotnet msbuild -t:BundleApp -p:RuntimeIdentifier=osx-x64 -property:Configuration=Release -p:SelfContained=true -p:TrimMode=link
dotnet restore -r osx-arm64
dotnet msbuild -t:BundleApp -p:RuntimeIdentifier=osx-arm64 -property:Configuration=Release -p:SelfContained=true -p:TrimMode=link
cd ./bin/Release/net9.0/
cd ./osx-x64/publish/
zip -9 -r ../../PCL.Neo.osx.mac.x64.app.zip ./PCL.Neo.app
cd ../../
cd ./osx-arm64/publish/
zip -9 -r ../../PCL.Neo.osx.mac.arm64.app.zip ./PCL.Neo.app
sh ./mac-publish-assets/package-mac.sh
cd ./mac-publish-assets/x64
zip -9 -r PCL.Neo.osx.mac.x64.app.zip PCL.Neo.app
cd ../arm64
zip -9 -r PCL.Neo.osx.mac.arm64.app.zip PCL.Neo.app
- name: UploadArtifacts osx.mac.arm64
uses: actions/upload-artifact@v4
with:
name: osx.mac.arm64
path: |
PCL.Neo/bin/Release/net9.0/PCL.Neo.osx.mac.arm64.app.zip
mac-publish-assets/arm64/PCL.Neo.osx.mac.arm64.app.zip
- name: UploadArtifacts osx.mac.x64
uses: actions/upload-artifact@v4
with:
name: osx.mac.x64
path: |
PCL.Neo/bin/Release/net9.0/PCL.Neo.osx.mac.x64.app.zip
mac-publish-assets/x64/PCL.Neo.osx.mac.x64.app.zip
build-WinExe:
runs-on: ubuntu-22.04
steps:
Expand Down
28 changes: 28 additions & 0 deletions mac-publish-assets/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>PCL.Neo</string>
<key>CFBundleDisplayName</key>
<string>PCL.Neo</string>
<key>CFBundleIdentifier</key>
<string>github.com/PCL-Community/PCL.Neo</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundlePackageType</key>
<string>AAPL</string>
<key>CFBundleSignature</key>
<string>PCL.Neo</string>
<key>CFBundleExecutable</key>
<string>PCL.Neo</string>
<key>CFBundleIconFile</key>
<string>PCL.Neo.icns</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<true />
</dict>
</plist>
Binary file added mac-publish-assets/PCL.Neo.icns
Binary file not shown.
10 changes: 10 additions & 0 deletions mac-publish-assets/PCLNeoEntitlements.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.automation.apple-events</key>
<true/>
</dict>
</plist>
60 changes: 60 additions & 0 deletions mac-publish-assets/package-mac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash
# 此脚本中签名和hdiutil的部分只能在Mac上运行!

INFO_PLIST="Info.plist"
ICON_FILE="PCL.Neo.icns"
ENTITLEMENTS="PCLNeoEntitlements.entitlements"
# SIGNING_IDENTITY="Developer ID: PCLCommunity"

cd ./PCL.Neo
dotnet publish -r osx-arm64 --configuration Release -p:UseAppHost=true
dotnet publish -r osx-x64 --configuration Release -p:UseAppHost=true

cd ../mac-publish-assets

# 创建输出目录
mkdir -p arm64
mkdir -p x64

# 打包 arm64 版本
APP_NAME_ARM64="arm64/PCL.Neo.app"
PUBLISH_OUTPUT_DIRECTORY_ARM64="../PCL.Neo/bin/Release/net9.0/osx-arm64/publish/."

if [ -d "$APP_NAME_ARM64" ]; then
rm -rf "$APP_NAME_ARM64"
fi

mkdir -p "$APP_NAME_ARM64/Contents/MacOS"
mkdir -p "$APP_NAME_ARM64/Contents/Resources"

cp "$INFO_PLIST" "$APP_NAME_ARM64/Contents/Info.plist"
cp "$ICON_FILE" "$APP_NAME_ARM64/Contents/Resources/PCL.Neo.icns"
cp -a $PUBLISH_OUTPUT_DIRECTORY_ARM64/* "$APP_NAME_ARM64/Contents/MacOS/"

# find "$APP_NAME_ARM64/Contents/MacOS/"|while read fname; do
# if [[ -f $fname ]]; then
# echo "[INFO] Signing $fname"
# codesign --force --timestamp --options=runtime --entitlements "$ENTITLEMENTS" --sign "$SIGNING_IDENTITY" "$fname"
# fi
# done

# echo "[INFO] Signing app file"

# codesign --force --timestamp --options=runtime --entitlements "$ENTITLEMENTS" --sign "$SIGNING_IDENTITY" "$APP_NAME"
# hdiutil create -volname "PCL.Neo.Arm64" -srcfolder $APP_NAME_ARM64 -ov -format UDZO arm64/PCL.Neo.dmg

# 打包 x64 版本
APP_NAME_X64="x64/PCL.Neo.app"
PUBLISH_OUTPUT_DIRECTORY_X64="../PCL.Neo/bin/Release/net9.0/osx-x64/publish/."

if [ -d "$APP_NAME_X64" ]; then
rm -rf "$APP_NAME_X64"
fi

mkdir -p "$APP_NAME_X64/Contents/MacOS"
mkdir -p "$APP_NAME_X64/Contents/Resources"

cp "$INFO_PLIST" "$APP_NAME_X64/Contents/Info.plist"
cp "$ICON_FILE" "$APP_NAME_X64/Contents/Resources/PCL.Neo.icns"
cp -a $PUBLISH_OUTPUT_DIRECTORY_X64/* "$APP_NAME_X64/Contents/MacOS/"
# hdiutil create -volname "PCL.Neo.X64" -srcfolder $APP_NAME_X64 -ov -format UDZO x64/PCL.Neo.dmg
Loading