Skip to content

Commit 4415881

Browse files
cyfung1031CodFrm
andauthored
👷 ci打包firefox产物 (MV2) (#544)
* firefox 打包 * 👷 ci打包firefox产物 --------- Co-authored-by: 王一之 <yz@ggnb.top>
1 parent b3be1a3 commit 4415881

2 files changed

Lines changed: 23 additions & 5 deletions

File tree

.github/workflows/build.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,21 @@ jobs:
3838
- name: Archive production artifacts
3939
uses: actions/upload-artifact@v4
4040
with:
41-
name: all-artifacts
41+
name: production-artifacts
4242
path: |
43-
dist/*.zip
4443
dist/*.crx
44+
dist/*.zip
4545
4646
- name: Archive extension
4747
uses: actions/upload-artifact@v4
4848
with:
49-
name: scriptcat
49+
name: chrome-extension
5050
path: |
5151
dist/ext/*
52+
53+
- name: Archive Firefox extension
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: firefox-extension
57+
path: |
58+
dist/ext-firefox/*

build/pack.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ chrome
120120
)
121121
);
122122

123+
const firefoxZipName = `./dist/${package.name}-v${package.version}-firefox.zip`;
123124
firefox
124125
.generateNodeStream({
125126
type: "nodebuffer",
@@ -128,9 +129,19 @@ firefox
128129
})
129130
.pipe(
130131
fs.createWriteStream(
131-
`./dist/${package.name}-v${package.version}-firefox.zip`
132+
firefoxZipName
132133
)
133-
);
134+
)
135+
.on("finish", () => {
136+
// 将firefox解压到ext-firefox
137+
fs.mkdirSync("./dist/ext-firefox", { recursive: true });
138+
execSync(
139+
`unzip -o ${firefoxZipName} -d ./dist/ext-firefox`,
140+
{
141+
stdio: "inherit",
142+
}
143+
);
144+
});
134145

135146
// 处理crx
136147
const crx = new ChromeExtension({

0 commit comments

Comments
 (0)