@@ -53,33 +53,53 @@ jobs:
5353 - name : Build .jar
5454 run : mvn clean package
5555
56- - name : Run jpackage for macOS
56+ - name : Build app bundle with jpackage
5757 env :
5858 APPLE_TEAM_ID : ${{ secrets.APPLE_TEAM_ID }}
5959 run : |
6060 # Get the certificate identity name
6161 CERT_IDENTITY=$(security find-identity -v -p codesigning | grep "Developer ID Application" | head -1 | sed -n 's/.*"\(.*\)"/\1/p')
6262 echo "Using certificate: $CERT_IDENTITY"
6363
64+ # First create just the app-image (app bundle), not DMG yet
6465 jpackage \
65- --type dmg \
66+ --type app-image \
6667 --name EWItool \
6768 --input target \
6869 --main-jar EWItool-${{ steps.version.outputs.version }}.jar \
6970 --main-class com.github.ledhed2222.ewitool.Main \
7071 --dest target \
7172 --app-version ${{ steps.version.outputs.version }} \
7273 --vendor "Ledhed2222" \
73- --icon src/main/resources/logo.icns \
74- --mac-sign \
75- --mac-signing-key-user-name "$CERT_IDENTITY"
74+ --icon src/main/resources/logo.icns
7675
77- - name : Sign DMG
76+ - name : Sign app bundle with hardened runtime
7877 run : |
7978 CERT_IDENTITY=$(security find-identity -v -p codesigning | grep "Developer ID Application" | head -1 | sed -n 's/.*"\(.*\)"/\1/p')
80- codesign --force --sign "$CERT_IDENTITY" --timestamp --options runtime target/EWItool-${{ steps.version.outputs.version }}.dmg
79+
80+ # Sign all nested binaries, libraries, and frameworks with hardened runtime
81+ find target/EWItool.app/Contents -type f \( -name "*.dylib" -o -name "*.jnilib" -o -perm +111 \) | while read file; do
82+ echo "Signing: $file"
83+ codesign --force --sign "$CERT_IDENTITY" --timestamp --options runtime "$file" || true
84+ done
85+
86+ # Sign the app bundle itself
87+ codesign --force --sign "$CERT_IDENTITY" --timestamp --options runtime --deep target/EWItool.app
8188
8289 # Verify signature
90+ codesign --verify --deep --strict --verbose=2 target/EWItool.app
91+
92+ - name : Create and sign DMG
93+ run : |
94+ CERT_IDENTITY=$(security find-identity -v -p codesigning | grep "Developer ID Application" | head -1 | sed -n 's/.*"\(.*\)"/\1/p')
95+
96+ # Create DMG from signed app bundle
97+ hdiutil create -volname EWItool -srcfolder target/EWItool.app -ov -format UDZO target/EWItool-${{ steps.version.outputs.version }}.dmg
98+
99+ # Sign the DMG
100+ codesign --force --sign "$CERT_IDENTITY" --timestamp target/EWItool-${{ steps.version.outputs.version }}.dmg
101+
102+ # Verify DMG signature
83103 codesign --verify --verbose=4 target/EWItool-${{ steps.version.outputs.version }}.dmg
84104
85105 - name : Notarize DMG
@@ -88,18 +108,36 @@ jobs:
88108 APPLE_APP_PASSWORD : ${{ secrets.APPLE_APP_PASSWORD }}
89109 APPLE_TEAM_ID : ${{ secrets.APPLE_TEAM_ID }}
90110 run : |
91- # Submit for notarization
92- xcrun notarytool submit target/EWItool-${{ steps.version.outputs.version }}.dmg \
111+ # Submit for notarization and capture submission ID
112+ SUBMIT_OUTPUT=$( xcrun notarytool submit target/EWItool-${{ steps.version.outputs.version }}.dmg \
93113 --apple-id "$APPLE_ID" \
94114 --password "$APPLE_APP_PASSWORD" \
95115 --team-id "$APPLE_TEAM_ID" \
96- --wait
97-
98- # Staple the notarization ticket
99- xcrun stapler staple target/EWItool-${{ steps.version.outputs.version }}.dmg
100-
101- # Verify notarization
102- xcrun stapler validate target/EWItool-${{ steps.version.outputs.version }}.dmg
116+ --wait 2>&1)
117+
118+ echo "$SUBMIT_OUTPUT"
119+
120+ # Extract submission ID
121+ SUBMISSION_ID=$(echo "$SUBMIT_OUTPUT" | grep "id:" | head -1 | awk '{print $2}')
122+ echo "Submission ID: $SUBMISSION_ID"
123+
124+ # Check if notarization succeeded
125+ if echo "$SUBMIT_OUTPUT" | grep -q "status: Accepted"; then
126+ echo "Notarization succeeded!"
127+
128+ # Staple the notarization ticket
129+ xcrun stapler staple target/EWItool-${{ steps.version.outputs.version }}.dmg
130+
131+ # Verify notarization
132+ xcrun stapler validate target/EWItool-${{ steps.version.outputs.version }}.dmg
133+ else
134+ echo "Notarization failed. Getting log..."
135+ xcrun notarytool log "$SUBMISSION_ID" \
136+ --apple-id "$APPLE_ID" \
137+ --password "$APPLE_APP_PASSWORD" \
138+ --team-id "$APPLE_TEAM_ID"
139+ exit 1
140+ fi
103141
104142 - name : Rename DMG
105143 run : |
0 commit comments