@@ -18,146 +18,143 @@ inputs:
1818runs :
1919 using : composite
2020 steps :
21- # Certificate setup
22- - name : Import Apple certificates
23- if : inputs.os == 'macos'
24- uses : apple-actions/import-codesign-certs@v3
25- with :
26- p12-file-base64 : ${{ env.APPLE_APP_CERTIFICATE_BASE64 }}
27- p12-password : ${{ env.APPLE_APP_CERTIFICATE_PASSWORD }}
28- keychain : build
29- keychain-password : ${{ github.run_id }}
30-
31- - name : Install Installer certificate
32- if : inputs.os == 'macos'
33- uses : apple-actions/import-codesign-certs@v3
34- with :
35- p12-file-base64 : ${{ env.APPLE_INSTALLER_CERTIFICATE_BASE64 }}
36- p12-password : ${{ env.APPLE_INSTALLER_CERTIFICATE_PASSWORD }}
37- keychain : build
38- keychain-password : ${{ github.run_id }}
39- # We don't need to create a keychain here because we're using the build keychain that was created in the previous step
40- create-keychain : false
41-
42- - name : Verify certificates
43- if : inputs.os == 'macos'
44- shell : ${{ inputs.shell }}
45- run : |
46- echo "Available signing identities:"
47- security find-identity -v -p codesigning build.keychain
48-
49- - name : Set up Python and other macOS dependencies
50- if : ${{ inputs.os == 'macos' }}
51- shell : ${{ inputs.shell }}
52- run : |
53- brew install python-setuptools
54- brew install create-dmg
55-
56- - name : Install dependencies for RPM and Flatpak package building
57- if : ${{ inputs.os == 'linux' }}
58- shell : ${{ inputs.shell }}
59- run : |
60- sudo apt-get update && sudo apt-get install rpm flatpak-builder elfutils
61- flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
62- FLATPAK_ARCH=$(if [[ ${{ inputs.arch }} = 'arm64' ]]; then echo 'aarch64'; else echo 'x86_64'; fi)
63- FLATPAK_VERSION='24.08'
64- flatpak install --user --no-deps --arch $FLATPAK_ARCH --assumeyes runtime/org.freedesktop.Platform/$FLATPAK_ARCH/$FLATPAK_VERSION runtime/org.freedesktop.Sdk/$FLATPAK_ARCH/$FLATPAK_VERSION org.electronjs.Electron2.BaseApp/$FLATPAK_ARCH/$FLATPAK_VERSION
65-
66- # Build setup
67- - name : Install dependencies
68- shell : ${{ inputs.shell }}
69- run : npm ci
70-
71- - name : Update build info
72- shell : ${{ inputs.shell }}
73- run : npm run chore:update-build-info
74-
75- # Critical debugging configuration
76- - name : Run electron-forge build with enhanced logging
77- shell : ${{ inputs.shell }}
78- env :
79- # Pass through required environment variables for signing and notarization
80- APPLE_TEAM_ID : ${{ env.APPLE_TEAM_ID }}
81- APPLE_ID : ${{ env.APPLE_ID }}
82- APPLE_ID_PASSWORD : ${{ env.APPLE_ID_PASSWORD }}
83- WINDOWS_SIGN_EXECUTABLE : ${{ env.WINDOWS_SIGN_EXECUTABLE }}
84- TRILIUM_ARTIFACT_NAME_HINT : TriliumNextNotes-${{ github.ref_name }}-${{ inputs.os }}-${{ inputs.arch }}
85- run : |
86- npm run electron-forge:make -- \
87- --arch=${{ inputs.arch }} \
88- --platform=${{ inputs.forge_platform }}
89-
90- # Add DMG signing step
91- - name : Sign DMG
92- if : inputs.os == 'macos'
93- shell : ${{ inputs.shell }}
94- run : |
95- echo "Signing DMG file..."
96- dmg_file=$(find ./dist -name "*.dmg" -print -quit)
97- if [ -n "$dmg_file" ]; then
98- echo "Found DMG: $dmg_file"
99- # Get the first valid signing identity from the keychain
100- SIGNING_IDENTITY=$(security find-identity -v -p codesigning build.keychain | grep "Developer ID Application" | head -1 | sed -E 's/.*"([^"]+)".*/\1/')
101- if [ -z "$SIGNING_IDENTITY" ]; then
102- echo "Error: No valid Developer ID Application certificate found in keychain"
103- exit 1
104- fi
105- echo "Using signing identity: $SIGNING_IDENTITY"
106- # Sign the DMG
107- codesign --force --sign "$SIGNING_IDENTITY" --options runtime --timestamp "$dmg_file"
108- # Notarize the DMG
109- xcrun notarytool submit "$dmg_file" --apple-id "$APPLE_ID" --password "$APPLE_ID_PASSWORD" --team-id "$APPLE_TEAM_ID" --wait
110- # Staple the notarization ticket
111- xcrun stapler staple "$dmg_file"
112- else
113- echo "No DMG found to sign"
114- fi
115-
116- - name : Verify code signing
117- if : inputs.os == 'macos'
118- shell : ${{ inputs.shell }}
119- run : |
120- echo "Verifying code signing for all artifacts..."
121-
122- # First check the .app bundle
123- echo "Looking for .app bundle..."
124- app_bundle=$(find ./dist -name "*.app" -print -quit)
125- if [ -n "$app_bundle" ]; then
126- echo "Found app bundle: $app_bundle"
127- echo "Verifying app bundle signing..."
128- codesign --verify --deep --strict --verbose=2 "$app_bundle"
129- echo "Displaying app bundle signing info..."
130- codesign --display --verbose=2 "$app_bundle"
131-
132- echo "Checking entitlements..."
133- codesign --display --entitlements :- "$app_bundle"
134-
135- echo "Checking notarization status..."
136- xcrun stapler validate "$app_bundle" || echo "Warning: App bundle not notarized yet"
137- else
138- echo "No .app bundle found to verify"
139- fi
140-
141- # Then check DMG if it exists
142- echo "Looking for DMG..."
143- dmg_file=$(find ./dist -name "*.dmg" -print -quit)
144- if [ -n "$dmg_file" ]; then
145- echo "Found DMG: $dmg_file"
146- echo "Verifying DMG signing..."
147- codesign --verify --deep --strict --verbose=2 "$dmg_file"
148- echo "Displaying DMG signing info..."
149- codesign --display --verbose=2 "$dmg_file"
150-
151- echo "Checking DMG notarization..."
152- xcrun stapler validate "$dmg_file" || echo "Warning: DMG not notarized yet"
153- else
154- echo "No DMG found to verify"
155- fi
156-
157- # Finally check ZIP if it exists
158- echo "Looking for ZIP..."
159- zip_file=$(find ./dist -name "*.zip" -print -quit)
160- if [ -n "$zip_file" ]; then
161- echo "Found ZIP: $zip_file"
162- echo "Note: ZIP files are not code signed, but their contents should be"
21+ # Certificate setup
22+ - name : Import Apple certificates
23+ if : inputs.os == 'macos'
24+ uses : apple-actions/import-codesign-certs@v3
25+ with :
26+ p12-file-base64 : ${{ env.APPLE_APP_CERTIFICATE_BASE64 }}
27+ p12-password : ${{ env.APPLE_APP_CERTIFICATE_PASSWORD }}
28+ keychain : build
29+ keychain-password : ${{ github.run_id }}
30+
31+ - name : Install Installer certificate
32+ if : inputs.os == 'macos'
33+ uses : apple-actions/import-codesign-certs@v3
34+ with :
35+ p12-file-base64 : ${{ env.APPLE_INSTALLER_CERTIFICATE_BASE64 }}
36+ p12-password : ${{ env.APPLE_INSTALLER_CERTIFICATE_PASSWORD }}
37+ keychain : build
38+ keychain-password : ${{ github.run_id }}
39+ # We don't need to create a keychain here because we're using the build keychain that was created in the previous step
40+ create-keychain : false
41+
42+ - name : Verify certificates
43+ if : inputs.os == 'macos'
44+ shell : ${{ inputs.shell }}
45+ run : |
46+ echo "Available signing identities:"
47+ security find-identity -v -p codesigning build.keychain
48+
49+ - name : Set up Python and other macOS dependencies
50+ if : ${{ inputs.os == 'macos' }}
51+ shell : ${{ inputs.shell }}
52+ run : |
53+ brew install python-setuptools
54+ brew install create-dmg
55+
56+ - name : Install dependencies for RPM and Flatpak package building
57+ if : ${{ inputs.os == 'linux' }}
58+ shell : ${{ inputs.shell }}
59+ run : |
60+ sudo apt-get update && sudo apt-get install rpm flatpak-builder elfutils
61+ flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
62+ FLATPAK_ARCH=$(if [[ ${{ inputs.arch }} = 'arm64' ]]; then echo 'aarch64'; else echo 'x86_64'; fi)
63+ FLATPAK_VERSION='24.08'
64+ flatpak install --user --no-deps --arch $FLATPAK_ARCH --assumeyes runtime/org.freedesktop.Platform/$FLATPAK_ARCH/$FLATPAK_VERSION runtime/org.freedesktop.Sdk/$FLATPAK_ARCH/$FLATPAK_VERSION org.electronjs.Electron2.BaseApp/$FLATPAK_ARCH/$FLATPAK_VERSION
65+
66+ # Build setup
67+ - name : Install dependencies
68+ shell : ${{ inputs.shell }}
69+ run : npm ci
70+
71+ - name : Update build info
72+ shell : ${{ inputs.shell }}
73+ run : npm run chore:update-build-info
74+
75+ # Critical debugging configuration
76+ - name : Run electron-forge build with enhanced logging
77+ shell : ${{ inputs.shell }}
78+ env :
79+ # Pass through required environment variables for signing and notarization
80+ APPLE_TEAM_ID : ${{ env.APPLE_TEAM_ID }}
81+ APPLE_ID : ${{ env.APPLE_ID }}
82+ APPLE_ID_PASSWORD : ${{ env.APPLE_ID_PASSWORD }}
83+ WINDOWS_SIGN_EXECUTABLE : ${{ env.WINDOWS_SIGN_EXECUTABLE }}
84+ TRILIUM_ARTIFACT_NAME_HINT : TriliumNextNotes-${{ github.ref_name }}-${{ inputs.os }}-${{ inputs.arch }}
85+ run : npm run electron-forge:make -- --arch=${{ inputs.arch }} --platform=${{ inputs.forge_platform }}
86+
87+ # Add DMG signing step
88+ - name : Sign DMG
89+ if : inputs.os == 'macos'
90+ shell : ${{ inputs.shell }}
91+ run : |
92+ echo "Signing DMG file..."
93+ dmg_file=$(find ./dist -name "*.dmg" -print -quit)
94+ if [ -n "$dmg_file" ]; then
95+ echo "Found DMG: $dmg_file"
96+ # Get the first valid signing identity from the keychain
97+ SIGNING_IDENTITY=$(security find-identity -v -p codesigning build.keychain | grep "Developer ID Application" | head -1 | sed -E 's/.*"([^"]+)".*/\1/')
98+ if [ -z "$SIGNING_IDENTITY" ]; then
99+ echo "Error: No valid Developer ID Application certificate found in keychain"
100+ exit 1
163101 fi
102+ echo "Using signing identity: $SIGNING_IDENTITY"
103+ # Sign the DMG
104+ codesign --force --sign "$SIGNING_IDENTITY" --options runtime --timestamp "$dmg_file"
105+ # Notarize the DMG
106+ xcrun notarytool submit "$dmg_file" --apple-id "$APPLE_ID" --password "$APPLE_ID_PASSWORD" --team-id "$APPLE_TEAM_ID" --wait
107+ # Staple the notarization ticket
108+ xcrun stapler staple "$dmg_file"
109+ else
110+ echo "No DMG found to sign"
111+ fi
112+
113+ - name : Verify code signing
114+ if : inputs.os == 'macos'
115+ shell : ${{ inputs.shell }}
116+ run : |
117+ echo "Verifying code signing for all artifacts..."
118+
119+ # First check the .app bundle
120+ echo "Looking for .app bundle..."
121+ app_bundle=$(find ./dist -name "*.app" -print -quit)
122+ if [ -n "$app_bundle" ]; then
123+ echo "Found app bundle: $app_bundle"
124+ echo "Verifying app bundle signing..."
125+ codesign --verify --deep --strict --verbose=2 "$app_bundle"
126+ echo "Displaying app bundle signing info..."
127+ codesign --display --verbose=2 "$app_bundle"
128+
129+ echo "Checking entitlements..."
130+ codesign --display --entitlements :- "$app_bundle"
131+
132+ echo "Checking notarization status..."
133+ xcrun stapler validate "$app_bundle" || echo "Warning: App bundle not notarized yet"
134+ else
135+ echo "No .app bundle found to verify"
136+ fi
137+
138+ # Then check DMG if it exists
139+ echo "Looking for DMG..."
140+ dmg_file=$(find ./dist -name "*.dmg" -print -quit)
141+ if [ -n "$dmg_file" ]; then
142+ echo "Found DMG: $dmg_file"
143+ echo "Verifying DMG signing..."
144+ codesign --verify --deep --strict --verbose=2 "$dmg_file"
145+ echo "Displaying DMG signing info..."
146+ codesign --display --verbose=2 "$dmg_file"
147+
148+ echo "Checking DMG notarization..."
149+ xcrun stapler validate "$dmg_file" || echo "Warning: DMG not notarized yet"
150+ else
151+ echo "No DMG found to verify"
152+ fi
153+
154+ # Finally check ZIP if it exists
155+ echo "Looking for ZIP..."
156+ zip_file=$(find ./dist -name "*.zip" -print -quit)
157+ if [ -n "$zip_file" ]; then
158+ echo "Found ZIP: $zip_file"
159+ echo "Note: ZIP files are not code signed, but their contents should be"
160+ fi
0 commit comments