mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
ci: downgrade Android CI JDK to 17 & convert afterAllArtifactBuild hook to CommonJS
This commit is contained in:
@@ -145,7 +145,7 @@ jobs:
|
|||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'zulu'
|
distribution: 'zulu'
|
||||||
java-version: '21'
|
java-version: '17'
|
||||||
- uses: gradle/gradle-build-action@v2
|
- uses: gradle/gradle-build-action@v2
|
||||||
with:
|
with:
|
||||||
gradle-version: 8.9
|
gradle-version: 8.9
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
// hook that runs after electron-build
|
const fs = require('fs-extra');
|
||||||
|
const path = require('path');
|
||||||
import fs from 'fs-extra';
|
const { execSync } = require('child_process');
|
||||||
import path from 'path';
|
const packageJson = require('../package.json');
|
||||||
import { execSync } from 'child_process';
|
const rootPath = path.resolve(__dirname, '..');
|
||||||
import packageJson from '../package.json' assert { type: 'json' };
|
|
||||||
import { fileURLToPath } from 'url';
|
|
||||||
const rootPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
||||||
const distFolderPath = path.resolve(rootPath, 'dist');
|
const distFolderPath = path.resolve(rootPath, 'dist');
|
||||||
|
|
||||||
const addPortableToPortableExecutableFileName = () => {
|
function addPortableToPortableExecutableFileName() {
|
||||||
const files = fs.readdirSync(distFolderPath);
|
const files = fs.readdirSync(distFolderPath);
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
if (file.endsWith('.exe') && !file.match('Setup')) {
|
if (file.endsWith('.exe') && !file.match('Setup')) {
|
||||||
@@ -17,9 +14,9 @@ const addPortableToPortableExecutableFileName = () => {
|
|||||||
fs.moveSync(filePath, renamedFilePath);
|
fs.moveSync(filePath, renamedFilePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
const createHtmlArchive = () => {
|
function createHtmlArchive() {
|
||||||
if (process.platform !== 'linux') {
|
if (process.platform !== 'linux') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -28,17 +25,14 @@ const createHtmlArchive = () => {
|
|||||||
const outputFile = path.resolve(distFolderPath, `${plebchanHtmlFolderName}.zip`);
|
const outputFile = path.resolve(distFolderPath, `${plebchanHtmlFolderName}.zip`);
|
||||||
const inputFolder = path.resolve(rootPath, 'build');
|
const inputFolder = path.resolve(rootPath, 'build');
|
||||||
try {
|
try {
|
||||||
// will break if node_modules/7zip-bin changes
|
|
||||||
execSync(`${zipBinPath} a ${outputFile} ${inputFolder}`);
|
execSync(`${zipBinPath} a ${outputFile} ${inputFolder}`);
|
||||||
// rename 'build' folder to 'plebchan-html-version' inside the archive
|
|
||||||
execSync(`${zipBinPath} rn -r ${outputFile} build ${plebchanHtmlFolderName}`);
|
execSync(`${zipBinPath} rn -r ${outputFile} build ${plebchanHtmlFolderName}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
e.message = 'electron build createHtmlArchive error: ' + e.message;
|
console.error('electron build createHtmlArchive error:', e);
|
||||||
console.log(e);
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
export default async (buildResult) => {
|
module.exports = async function afterAllArtifactBuild(buildResult) {
|
||||||
addPortableToPortableExecutableFileName();
|
addPortableToPortableExecutableFileName();
|
||||||
createHtmlArchive();
|
createHtmlArchive();
|
||||||
};
|
};
|
||||||
+1
-1
@@ -123,7 +123,7 @@
|
|||||||
"appId": "plebchan.desktop",
|
"appId": "plebchan.desktop",
|
||||||
"productName": "plebchan",
|
"productName": "plebchan",
|
||||||
"beforePack": "electron/before-pack.js",
|
"beforePack": "electron/before-pack.js",
|
||||||
"afterAllArtifactBuild": "electron/after-all-artifact-build.js",
|
"afterAllArtifactBuild": "electron/after-all-artifact-build.cjs",
|
||||||
"extraResources": [
|
"extraResources": [
|
||||||
{
|
{
|
||||||
"from": "bin/${os}",
|
"from": "bin/${os}",
|
||||||
|
|||||||
Reference in New Issue
Block a user