Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0e7c722

Browse files
committedFeb 25, 2025··
Merge remote-tracking branch 'origin/develop' into style/next/restyle-ckeditor
2 parents ec3d7bd + 3476223 commit 0e7c722

File tree

393 files changed

+14314
-3319
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

393 files changed

+14314
-3319
lines changed
 
+188-14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
name: "Build Electron App"
2+
description: "Builds and packages the Electron app for different platforms"
3+
14
inputs:
25
os:
36
description: "One of the supported platforms: macos, linux, windows"
@@ -6,34 +9,205 @@ inputs:
69
description: "The architecture to build for: x64, arm64"
710
required: true
811
extension:
9-
description: "Platform specific extension to build: dmg, deb, exe"
12+
description: "Platform specific extensions to copy in the output: dmg, deb, rpm, exe, zip"
1013
required: true
14+
1115
runs:
1216
using: composite
1317
steps:
14-
- name: Set up Python for appdmg to be installed
18+
# Certificate setup
19+
- name: Import Apple certificates
20+
if: inputs.os == 'macos'
21+
uses: apple-actions/import-codesign-certs@v2
22+
with:
23+
p12-file-base64: ${{ env.APPLE_APP_CERTIFICATE_BASE64 }}
24+
p12-password: ${{ env.APPLE_APP_CERTIFICATE_PASSWORD }}
25+
keychain: build
26+
keychain-password: ${{ github.run_id }}
27+
28+
- name: Install Installer certificate
29+
if: inputs.os == 'macos'
30+
uses: apple-actions/import-codesign-certs@v2
31+
with:
32+
p12-file-base64: ${{ env.APPLE_INSTALLER_CERTIFICATE_BASE64 }}
33+
p12-password: ${{ env.APPLE_INSTALLER_CERTIFICATE_PASSWORD }}
34+
keychain: build
35+
keychain-password: ${{ github.run_id }}
36+
# We don't need to create a keychain here because we're using the build keychain that was created in the previous step
37+
create-keychain: false
38+
39+
- name: Verify certificates
40+
if: inputs.os == 'macos'
41+
shell: bash
42+
run: |
43+
echo "Available signing identities:"
44+
security find-identity -v -p codesigning build.keychain
45+
46+
- name: Set up Python and other macOS dependencies
1547
if: ${{ inputs.os == 'macos' }}
1648
shell: bash
17-
run: brew install python-setuptools
18-
- name: Install rpm on Ubuntu for RPM package building
49+
run: |
50+
brew install python-setuptools
51+
brew install create-dmg
52+
53+
- name: Install dependencies for RPM and Flatpak package building
1954
if: ${{ inputs.os == 'linux' }}
2055
shell: bash
21-
run: sudo apt install rpm
56+
run: |
57+
sudo apt-get update && sudo apt-get install rpm flatpak-builder elfutils
58+
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
59+
FLATPAK_ARCH=$(if [[ ${{ inputs.arch }} = 'arm64' ]]; then echo 'aarch64'; else echo 'x86_64'; fi)
60+
FLATPAK_VERSION='24.08'
61+
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
62+
63+
# Build setup
2264
- name: Install dependencies
2365
shell: bash
2466
run: npm ci
67+
2568
- name: Update build info
2669
shell: bash
27-
run: npm run update-build-info
28-
- name: Run electron-forge
70+
run: npm run chore:update-build-info
71+
72+
# Critical debugging configuration
73+
- name: Run electron-forge build with enhanced logging
2974
shell: bash
30-
run: npm run make-electron -- --arch=${{ inputs.arch }}
75+
env:
76+
# Pass through required environment variables for signing and notarization
77+
APPLE_TEAM_ID: ${{ env.APPLE_TEAM_ID }}
78+
APPLE_ID: ${{ env.APPLE_ID }}
79+
APPLE_ID_PASSWORD: ${{ env.APPLE_ID_PASSWORD }}
80+
run: |
81+
# Map OS names to Electron Forge platform names
82+
if [ "${{ inputs.os }}" = "macos" ]; then
83+
PLATFORM="darwin"
84+
elif [ "${{ inputs.os }}" = "windows" ]; then
85+
PLATFORM="win32"
86+
else
87+
PLATFORM="${{ inputs.os }}"
88+
fi
89+
90+
npm run electron-forge:make -- \
91+
--arch=${{ inputs.arch }} \
92+
--platform=$PLATFORM
93+
94+
# Add DMG signing step
95+
- name: Sign DMG
96+
if: inputs.os == 'macos'
97+
shell: bash
98+
run: |
99+
echo "Signing DMG file..."
100+
dmg_file=$(find out -name "*.dmg" -print -quit)
101+
if [ -n "$dmg_file" ]; then
102+
echo "Found DMG: $dmg_file"
103+
# Get the first valid signing identity from the keychain
104+
SIGNING_IDENTITY=$(security find-identity -v -p codesigning build.keychain | grep "Developer ID Application" | head -1 | sed -E 's/.*"([^"]+)".*/\1/')
105+
if [ -z "$SIGNING_IDENTITY" ]; then
106+
echo "Error: No valid Developer ID Application certificate found in keychain"
107+
exit 1
108+
fi
109+
echo "Using signing identity: $SIGNING_IDENTITY"
110+
# Sign the DMG
111+
codesign --force --sign "$SIGNING_IDENTITY" --options runtime --timestamp "$dmg_file"
112+
# Notarize the DMG
113+
xcrun notarytool submit "$dmg_file" --apple-id "$APPLE_ID" --password "$APPLE_ID_PASSWORD" --team-id "$APPLE_TEAM_ID" --wait
114+
# Staple the notarization ticket
115+
xcrun stapler staple "$dmg_file"
116+
else
117+
echo "No DMG found to sign"
118+
fi
119+
120+
- name: Verify code signing
121+
if: inputs.os == 'macos'
122+
shell: bash
123+
run: |
124+
echo "Verifying code signing for all artifacts..."
125+
126+
# First check the .app bundle
127+
echo "Looking for .app bundle..."
128+
app_bundle=$(find out -name "*.app" -print -quit)
129+
if [ -n "$app_bundle" ]; then
130+
echo "Found app bundle: $app_bundle"
131+
echo "Verifying app bundle signing..."
132+
codesign --verify --deep --strict --verbose=2 "$app_bundle"
133+
echo "Displaying app bundle signing info..."
134+
codesign --display --verbose=2 "$app_bundle"
135+
136+
echo "Checking entitlements..."
137+
codesign --display --entitlements :- "$app_bundle"
138+
139+
echo "Checking notarization status..."
140+
xcrun stapler validate "$app_bundle" || echo "Warning: App bundle not notarized yet"
141+
else
142+
echo "No .app bundle found to verify"
143+
fi
144+
145+
# Then check DMG if it exists
146+
echo "Looking for DMG..."
147+
dmg_file=$(find out -name "*.dmg" -print -quit)
148+
if [ -n "$dmg_file" ]; then
149+
echo "Found DMG: $dmg_file"
150+
echo "Verifying DMG signing..."
151+
codesign --verify --deep --strict --verbose=2 "$dmg_file"
152+
echo "Displaying DMG signing info..."
153+
codesign --display --verbose=2 "$dmg_file"
154+
155+
echo "Checking DMG notarization..."
156+
xcrun stapler validate "$dmg_file" || echo "Warning: DMG not notarized yet"
157+
else
158+
echo "No DMG found to verify"
159+
fi
160+
161+
# Finally check ZIP if it exists
162+
echo "Looking for ZIP..."
163+
zip_file=$(find out -name "*.zip" -print -quit)
164+
if [ -n "$zip_file" ]; then
165+
echo "Found ZIP: $zip_file"
166+
echo "Note: ZIP files are not code signed, but their contents should be"
167+
fi
168+
31169
- name: Prepare artifacts
32170
shell: bash
33171
run: |
34-
mkdir -p upload;
35-
for ext in ${{ join(inputs.extension, ' ') }};
36-
do
37-
file=$(find out/make -name "*.$ext" -print -quit);
38-
cp "$file" "upload/TriliumNextNotes-${{ github.ref_name }}-${{ inputs.os }}-${{ inputs.arch }}.$ext";
39-
done
172+
mkdir -p upload
173+
174+
if [ "${{ inputs.os }}" = "macos" ]; then
175+
# For macOS, we need to look in specific directories based on the maker
176+
echo "Collecting macOS artifacts..."
177+
178+
# Look for DMG files recursively
179+
echo "Looking for DMG files..."
180+
dmg_file=$(find out -name "*.dmg" -print -quit)
181+
if [ -n "$dmg_file" ]; then
182+
echo "Found DMG: $dmg_file"
183+
cp "$dmg_file" "upload/TriliumNextNotes-${{ github.ref_name }}-darwin-${{ inputs.arch }}.dmg"
184+
else
185+
echo "Warning: No DMG file found"
186+
fi
187+
188+
# Look for ZIP files recursively
189+
echo "Looking for ZIP files..."
190+
zip_file=$(find out -name "*.zip" -print -quit)
191+
if [ -n "$zip_file" ]; then
192+
echo "Found ZIP: $zip_file"
193+
cp "$zip_file" "upload/TriliumNextNotes-${{ github.ref_name }}-darwin-${{ inputs.arch }}.zip"
194+
else
195+
echo "Warning: No ZIP file found"
196+
fi
197+
else
198+
# For other platforms, use the existing logic but with better error handling
199+
echo "Collecting artifacts for ${{ inputs.os }}..."
200+
for ext in ${{ inputs.extension }}; do
201+
echo "Looking for .$ext files..."
202+
file=$(find out -name "*.$ext" -print -quit)
203+
if [ -n "$file" ]; then
204+
echo "Found $file for extension $ext"
205+
cp "$file" "upload/TriliumNextNotes-${{ github.ref_name }}-${{ inputs.os }}-${{ inputs.arch }}.$ext"
206+
else
207+
echo "Warning: No file found with extension .$ext"
208+
fi
209+
done
210+
fi
211+
212+
echo "Final contents of upload directory:"
213+
ls -la upload/

‎.github/actions/build-server/action.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
inputs:
2+
os:
3+
description: "One of the supported platforms: windows"
4+
required: true
25
arch:
36
description: "The architecture to build for: x64, arm64"
47
required: true
@@ -18,11 +21,11 @@ runs:
1821
MATRIX_ARCH: ${{ inputs.arch }}
1922
shell: bash
2023
run: |
21-
npm run update-build-info
24+
npm run chore:update-build-info
2225
./bin/build-server.sh
2326
- name: Prepare artifacts
2427
shell: bash
2528
run: |
2629
mkdir -p upload
2730
file=$(find dist -name '*.tar.xz' -print -quit)
28-
cp "$file" "upload/TriliumNextNotes-linux-${{ inputs.arch }}-${{ github.ref_name }}.tar.xz"
31+
cp "$file" "upload/TriliumNextNotes-Server-${{ github.ref_name }}-${{ inputs.os }}-${{ inputs.arch }}.tar.xz"

0 commit comments

Comments
 (0)
Please sign in to comment.