Skip to content

Build your personal knowledge base with Trilium Notes

chore(ci): use electron-forge hook for gathering artifacts

Elian Doranfae9a1f796d0
diff --git a/.github/actions/build-electron/action.yml b/.github/actions/build-electron/action.yml
index fb41ac392f..5a4aa11a20 100644
--- a/.github/actions/build-electron/action.yml
+++ b/.github/actions/build-electron/action.yml
@@ -158,49 +158,3 @@ runs:
echo "Found ZIP: $zip_file"
echo "Note: ZIP files are not code signed, but their contents should be"
fi
-
- - name: Prepare artifacts
- shell: cmd
- run: |
- mkdir -p upload
-
- if [ "${{ inputs.os }}" = "macos" ]; then
- # For macOS, we need to look in specific directories based on the maker
- echo "Collecting macOS artifacts..."
-
- # Look for DMG files recursively
- echo "Looking for DMG files..."
- dmg_file=$(find ./dist -name "*.dmg" -print -quit)
- if [ -n "$dmg_file" ]; then
- echo "Found DMG: $dmg_file"
- cp "$dmg_file" "upload/TriliumNextNotes-${{ github.ref_name }}-macos-${{ inputs.arch }}.dmg"
- else
- echo "Warning: No DMG file found"
- fi
-
- # Look for ZIP files recursively
- echo "Looking for ZIP files..."
- zip_file=$(find ./dist -name "*.zip" -print -quit)
- if [ -n "$zip_file" ]; then
- echo "Found ZIP: $zip_file"
- cp "$zip_file" "upload/TriliumNextNotes-${{ github.ref_name }}-macos-${{ inputs.arch }}.zip"
- else
- echo "Warning: No ZIP file found"
- fi
- else
- # For other platforms, use the existing logic but with better error handling
- echo "Collecting artifacts for ${{ inputs.os }}..."
- for ext in ${{ inputs.extension }}; do
- echo "Looking for .$ext files..."
- file=$(find ./dist -name "*.$ext" -print -quit)
- if [ -n "$file" ]; then
- echo "Found $file for extension $ext"
- cp "$file" "upload/TriliumNextNotes-${{ github.ref_name }}-${{ inputs.os }}-${{ inputs.arch }}.$ext"
- else
- echo "Warning: No file found with extension .$ext"
- fi
- done
- fi
-
- echo "Final contents of upload directory:"
- ls -la upload/
diff --git a/forge.config.cjs b/forge.config.cjs
index dabcd7ca41..7cd50d44de 100644
--- a/forge.config.cjs
+++ b/forge.config.cjs
@@ -129,7 +129,20 @@ module.exports = {
name: "@electron-forge/plugin-auto-unpack-natives",
config: {}
}
- ]
+ ],
+ hooks: {
+ postMake(_, makeResults) {
+ const outputDir = path.join(__dirname, "upload");
+ fs.mkdirp(outputDir);
+ for (const makeResult of makeResults) {
+ for (const artifactPath of makeResult.artifacts) {
+ const outputPath = path.join(outputDir, path.basename(artifactPath));
+ console.log(`[Artifact] ${artifactPath} -> ${outputPath}`);
+ fs.copyFile(artifactPath, outputPath);
+ }
+ }
+ }
+ }
};
function getExtraResourcesForPlatform() {