@@ -18,144 +18,144 @@ 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- env :
71- npm_config_arch : ${{ inputs.arch }}
72-
73- - name : Update build info
74- shell : ${{ inputs.shell }}
75- run : npm run chore:update-build-info
76-
77- - name : Run electron-forge build with enhanced logging
78- shell : ${{ inputs.shell }}
79- env :
80- # Pass through required environment variables for signing and notarization
81- APPLE_TEAM_ID : ${{ env.APPLE_TEAM_ID }}
82- APPLE_ID : ${{ env.APPLE_ID }}
83- APPLE_ID_PASSWORD : ${{ env.APPLE_ID_PASSWORD }}
84- WINDOWS_SIGN_EXECUTABLE : ${{ env.WINDOWS_SIGN_EXECUTABLE }}
85- TRILIUM_ARTIFACT_NAME_HINT : TriliumNextNotes-${{ github.ref_name }}-${{ inputs.os }}-${{ inputs.arch }}
86- run : npm run electron-forge:make --arch=${{ inputs.arch }} --platform=${{ inputs.forge_platform }}
87-
88- # Add DMG signing step
89- - name : Sign DMG
90- if : inputs.os == 'macos'
91- shell : ${{ inputs.shell }}
92- run : |
93- echo "Signing DMG file..."
94- dmg_file=$(find ./dist -name "*.dmg" -print -quit)
95- if [ -n "$dmg_file" ]; then
96- echo "Found DMG: $dmg_file"
97- # Get the first valid signing identity from the keychain
98- SIGNING_IDENTITY=$(security find-identity -v -p codesigning build.keychain | grep "Developer ID Application" | head -1 | sed -E 's/.*"([^"]+)".*/\1/')
99- if [ -z "$SIGNING_IDENTITY" ]; then
100- echo "Error: No valid Developer ID Application certificate found in keychain"
101- exit 1
102- fi
103- echo "Using signing identity: $SIGNING_IDENTITY"
104- # Sign the DMG
105- codesign --force --sign "$SIGNING_IDENTITY" --options runtime --timestamp "$dmg_file"
106- # Notarize the DMG
107- xcrun notarytool submit "$dmg_file" --apple-id "$APPLE_ID" --password "$APPLE_ID_PASSWORD" --team-id "$APPLE_TEAM_ID" --wait
108- # Staple the notarization ticket
109- xcrun stapler staple "$dmg_file"
110- else
111- echo "No DMG found to sign"
112- fi
113-
114- - name : Verify code signing
115- if : inputs.os == 'macos'
116- shell : ${{ inputs.shell }}
117- run : |
118- echo "Verifying code signing for all artifacts..."
119-
120- # First check the .app bundle
121- echo "Looking for .app bundle..."
122- app_bundle=$(find ./dist -name "*.app" -print -quit)
123- if [ -n "$app_bundle" ]; then
124- echo "Found app bundle: $app_bundle"
125- echo "Verifying app bundle signing..."
126- codesign --verify --deep --strict --verbose=2 "$app_bundle"
127- echo "Displaying app bundle signing info..."
128- codesign --display --verbose=2 "$app_bundle"
129-
130- echo "Checking entitlements..."
131- codesign --display --entitlements :- "$app_bundle"
132-
133- echo "Checking notarization status..."
134- xcrun stapler validate "$app_bundle" || echo "Warning: App bundle not notarized yet"
135- else
136- echo "No .app bundle found to verify"
137- fi
138-
139- # Then check DMG if it exists
140- echo "Looking for DMG..."
141- dmg_file=$(find ./dist -name "*.dmg" -print -quit)
142- if [ -n "$dmg_file" ]; then
143- echo "Found DMG: $dmg_file"
144- echo "Verifying DMG signing..."
145- codesign --verify --deep --strict --verbose=2 "$dmg_file"
146- echo "Displaying DMG signing info..."
147- codesign --display --verbose=2 "$dmg_file"
148-
149- echo "Checking DMG notarization..."
150- xcrun stapler validate "$dmg_file" || echo "Warning: DMG not notarized yet"
151- else
152- echo "No DMG found to verify"
153- fi
154-
155- # Finally check ZIP if it exists
156- echo "Looking for ZIP..."
157- zip_file=$(find ./dist -name "*.zip" -print -quit)
158- if [ -n "$zip_file" ]; then
159- echo "Found ZIP: $zip_file"
160- 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+ env :
71+ npm_config_arch : ${{ inputs.arch }}
72+
73+ - name : Update build info
74+ shell : ${{ inputs.shell }}
75+ run : npm run chore:update-build-info
76+
77+ - name : Run electron-forge build with enhanced logging
78+ shell : ${{ inputs.shell }}
79+ env :
80+ # Pass through required environment variables for signing and notarization
81+ APPLE_TEAM_ID : ${{ env.APPLE_TEAM_ID }}
82+ APPLE_ID : ${{ env.APPLE_ID }}
83+ APPLE_ID_PASSWORD : ${{ env.APPLE_ID_PASSWORD }}
84+ WINDOWS_SIGN_EXECUTABLE : ${{ env.WINDOWS_SIGN_EXECUTABLE }}
85+ TRILIUM_ARTIFACT_NAME_HINT : TriliumNextNotes-${{ github.ref_name }}-${{ inputs.os }}-${{ inputs.arch }}
86+ run : npm run electron-forge:make -- --arch=${{ inputs.arch }} --platform=${{ inputs.forge_platform }}
87+
88+ # Add DMG signing step
89+ - name : Sign DMG
90+ if : inputs.os == 'macos'
91+ shell : ${{ inputs.shell }}
92+ run : |
93+ echo "Signing DMG file..."
94+ dmg_file=$(find ./dist -name "*.dmg" -print -quit)
95+ if [ -n "$dmg_file" ]; then
96+ echo "Found DMG: $dmg_file"
97+ # Get the first valid signing identity from the keychain
98+ SIGNING_IDENTITY=$(security find-identity -v -p codesigning build.keychain | grep "Developer ID Application" | head -1 | sed -E 's/.*"([^"]+)".*/\1/')
99+ if [ -z "$SIGNING_IDENTITY" ]; then
100+ echo "Error: No valid Developer ID Application certificate found in keychain"
101+ exit 1
161102 fi
103+ echo "Using signing identity: $SIGNING_IDENTITY"
104+ # Sign the DMG
105+ codesign --force --sign "$SIGNING_IDENTITY" --options runtime --timestamp "$dmg_file"
106+ # Notarize the DMG
107+ xcrun notarytool submit "$dmg_file" --apple-id "$APPLE_ID" --password "$APPLE_ID_PASSWORD" --team-id "$APPLE_TEAM_ID" --wait
108+ # Staple the notarization ticket
109+ xcrun stapler staple "$dmg_file"
110+ else
111+ echo "No DMG found to sign"
112+ fi
113+
114+ - name : Verify code signing
115+ if : inputs.os == 'macos'
116+ shell : ${{ inputs.shell }}
117+ run : |
118+ echo "Verifying code signing for all artifacts..."
119+
120+ # First check the .app bundle
121+ echo "Looking for .app bundle..."
122+ app_bundle=$(find ./dist -name "*.app" -print -quit)
123+ if [ -n "$app_bundle" ]; then
124+ echo "Found app bundle: $app_bundle"
125+ echo "Verifying app bundle signing..."
126+ codesign --verify --deep --strict --verbose=2 "$app_bundle"
127+ echo "Displaying app bundle signing info..."
128+ codesign --display --verbose=2 "$app_bundle"
129+
130+ echo "Checking entitlements..."
131+ codesign --display --entitlements :- "$app_bundle"
132+
133+ echo "Checking notarization status..."
134+ xcrun stapler validate "$app_bundle" || echo "Warning: App bundle not notarized yet"
135+ else
136+ echo "No .app bundle found to verify"
137+ fi
138+
139+ # Then check DMG if it exists
140+ echo "Looking for DMG..."
141+ dmg_file=$(find ./dist -name "*.dmg" -print -quit)
142+ if [ -n "$dmg_file" ]; then
143+ echo "Found DMG: $dmg_file"
144+ echo "Verifying DMG signing..."
145+ codesign --verify --deep --strict --verbose=2 "$dmg_file"
146+ echo "Displaying DMG signing info..."
147+ codesign --display --verbose=2 "$dmg_file"
148+
149+ echo "Checking DMG notarization..."
150+ xcrun stapler validate "$dmg_file" || echo "Warning: DMG not notarized yet"
151+ else
152+ echo "No DMG found to verify"
153+ fi
154+
155+ # Finally check ZIP if it exists
156+ echo "Looking for ZIP..."
157+ zip_file=$(find ./dist -name "*.zip" -print -quit)
158+ if [ -n "$zip_file" ]; then
159+ echo "Found ZIP: $zip_file"
160+ echo "Note: ZIP files are not code signed, but their contents should be"
161+ fi
0 commit comments