ci: downgrade Android CI JDK to 17 & convert afterAllArtifactBuild hook to CommonJS

This commit is contained in:
Tom (plebeius.eth)
2025-05-13 15:57:51 +02:00
parent ee69126905
commit d461d08f12
3 changed files with 14 additions and 20 deletions
+1 -1
View File
@@ -145,7 +145,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '21'
java-version: '17'
- uses: gradle/gradle-build-action@v2
with:
gradle-version: 8.9
@@ -1,14 +1,11 @@
// hook that runs after electron-build
import fs from 'fs-extra';
import path from 'path';
import { execSync } from 'child_process';
import packageJson from '../package.json' assert { type: 'json' };
import { fileURLToPath } from 'url';
const rootPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const fs = require('fs-extra');
const path = require('path');
const { execSync } = require('child_process');
const packageJson = require('../package.json');
const rootPath = path.resolve(__dirname, '..');
const distFolderPath = path.resolve(rootPath, 'dist');
const addPortableToPortableExecutableFileName = () => {
function addPortableToPortableExecutableFileName() {
const files = fs.readdirSync(distFolderPath);
for (const file of files) {
if (file.endsWith('.exe') && !file.match('Setup')) {
@@ -17,9 +14,9 @@ const addPortableToPortableExecutableFileName = () => {
fs.moveSync(filePath, renamedFilePath);
}
}
};
}
const createHtmlArchive = () => {
function createHtmlArchive() {
if (process.platform !== 'linux') {
return;
}
@@ -28,17 +25,14 @@ const createHtmlArchive = () => {
const outputFile = path.resolve(distFolderPath, `${plebchanHtmlFolderName}.zip`);
const inputFolder = path.resolve(rootPath, 'build');
try {
// will break if node_modules/7zip-bin changes
execSync(`${zipBinPath} a ${outputFile} ${inputFolder}`);
// rename 'build' folder to 'plebchan-html-version' inside the archive
execSync(`${zipBinPath} rn -r ${outputFile} build ${plebchanHtmlFolderName}`);
} catch (e) {
e.message = 'electron build createHtmlArchive error: ' + e.message;
console.log(e);
console.error('electron build createHtmlArchive error:', e);
}
};
}
export default async (buildResult) => {
module.exports = async function afterAllArtifactBuild(buildResult) {
addPortableToPortableExecutableFileName();
createHtmlArchive();
};
};
+1 -1
View File
@@ -123,7 +123,7 @@
"appId": "plebchan.desktop",
"productName": "plebchan",
"beforePack": "electron/before-pack.js",
"afterAllArtifactBuild": "electron/after-all-artifact-build.js",
"afterAllArtifactBuild": "electron/after-all-artifact-build.cjs",
"extraResources": [
{
"from": "bin/${os}",