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

This commit is contained in:
Elian Doran 2025-03-23 23:06:41 +02:00
parent a709f68af9
commit fae9a1f796
No known key found for this signature in database
2 changed files with 14 additions and 47 deletions

View File

@ -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/

View File

@ -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() {