Skip to content

Commit 2c30075

Browse files
committed
chore: update actions
1 parent 7c5dac4 commit 2c30075

3 files changed

Lines changed: 19 additions & 11 deletions

File tree

.github/workflows/dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- uses: actions/checkout@v6
3333
with:
3434
fetch-depth: 2
35-
- uses: dorny/paths-filter@v3
35+
- uses: dorny/paths-filter@v4
3636
id: filter
3737
with:
3838
base: ${{ github.ref_name }}

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- uses: actions/checkout@v6
1919
with:
2020
fetch-depth: 2
21-
- uses: dorny/paths-filter@v3
21+
- uses: dorny/paths-filter@v4
2222
id: filter
2323
with:
2424
base: ${{ github.ref_name }}

scripts/pack.mjs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111

1212
import { mkdir, unlink } from 'node:fs/promises';
13+
import { join } from 'node:path';
1314
import { rimraf } from 'rimraf';
1415
import getManifest from './browser-config/get-manifest.js';
1516
import {
@@ -18,12 +19,13 @@ import {
1819
extension,
1920
getDistPath,
2021
getVersion,
22+
scriptRoot,
2123
} from './config.mjs';
2224
import amo from './pack-utils/amo.mjs';
2325
import cws from './pack-utils/cws.mjs';
2426
import edge from './pack-utils/edge.mjs';
2527
import xpi from './pack-utils/xpi.mjs';
26-
import { copyDir, outputJSON } from './utils.mjs';
28+
import { copyDir, outputJSON, readJSON } from './utils.mjs';
2729
import { createZip } from './zip.mjs';
2830

2931
const packUtils = {
@@ -36,8 +38,8 @@ const packUtils = {
3638
/**
3739
* 打包一个平台的产物
3840
* @param {*} name
39-
* @param {*} browserConfig 对应browser.config.json中的配置
40-
* @param {*} extensionConfig 对应extension.json中的配置
41+
* @param {*} browserConfig 对应browser.config.json中的单项配置
42+
* @param {*} extensionConfig 对应extension.json中的单项配置
4143
* @returns
4244
*/
4345
async function prepareOnePlatform(name, extensionConfig) {
@@ -62,15 +64,15 @@ async function prepareOnePlatform(name, extensionConfig) {
6264
}),
6365
);
6466
// 打包成zip
65-
console.log(`zip ${thisPack} -> ${zipPath}`);
67+
console.log(`[${name}] zip ${thisPack} -> ${zipPath}`);
6668
await createZip(thisPack, zipPath);
6769
} catch (e) {
68-
console.error(`Prepare ${name} error`);
70+
console.error(`[${name}] prepare error`);
6971
console.error(e);
7072
}
7173
return { dirName, thisPack, zipPath };
7274
}
73-
async function packOnePlatform(name, prepare, extensionConfig) {
75+
async function packOnePlatform(name, prepare, browserConfig, extensionConfig) {
7476
const { thisPack, zipPath } = prepare;
7577
if (typeof packUtils[name] === 'undefined') {
7678
console.error(`pack-utils for ${name} not found`);
@@ -82,11 +84,12 @@ async function packOnePlatform(name, prepare, extensionConfig) {
8284
sourcePath: thisPack,
8385
zipPath,
8486
releasePath: _path.release,
87+
browserConfig,
8588
extensionConfig,
8689
});
87-
console.log(`Pack ${name} success: ${res}`);
90+
console.log(`[${name}] pack success: ${res}`);
8891
} catch (e) {
89-
console.error(`Pack ${name} error`);
92+
console.error(`[${name}] pack error`);
9093
console.error(e);
9194
}
9295
try {
@@ -118,13 +121,18 @@ async function main() {
118121
);
119122
}
120123

124+
const browserConfig = await readJSON(
125+
join(scriptRoot, 'browser-config/browser.config.json'),
126+
);
127+
121128
const queue = [];
122129

123130
for (const name of platform) {
124131
const platformConfig = extension[name];
125132
for (const item of platformConfig) {
133+
const browser = browserConfig[item.browser];
126134
const prepare = await prepareOnePlatform(name, item);
127-
queue.push(packOnePlatform(name, { ...prepare }, item));
135+
queue.push(packOnePlatform(name, { ...prepare }, browser, item));
128136
}
129137
}
130138

0 commit comments

Comments
 (0)