You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

配置GitHub Action生成Firefox扩展压缩包遇错求助

正确的Firefox分支打包工作流配置

问题出在两个核心点:

  • 你错误地将uses指向了自己仓库的分支,而非官方的Zip Release Action地址
  • 虽然添加了checkout步骤,但未指定要拉取的目标分支dev-firefox

以下是可直接复用的完整工作流配置(.github/workflows/firefox.yml):

name: Build Firefox Extension Zip
on:
  # 可选:dev-firefox分支有代码推送时自动触发打包
  push:
    branches: [ dev-firefox ]
  # 可选:允许手动触发工作流
  workflow_dispatch:

jobs:
  build-zip:
    runs-on: ubuntu-latest
    steps:
      # 拉取dev-firefox分支的代码,必须指定ref参数明确分支
      - name: Checkout dev-firefox branch
        uses: actions/checkout@v4
        with:
          ref: dev-firefox
          fetch-depth: 1

      # 使用官方Zip Release Action执行打包
      - name: Create Firefox Extension Zip
        uses: vimtor/action-zip-release@v1
        with:
          # 自定义生成的压缩包文件名
          filename: firefox-extension.zip
          # 指定要打包的路径,根据你的扩展结构调整(示例为根目录所有文件)
          path: .
          # 排除不需要打包的冗余文件(可选)
          exclude: '*.git* .github/* node_modules/*'
          # 可选:为压缩包添加版本标识(用分支名+运行编号)
          tag: dev-firefox-${{ github.run_number }}

关键细节说明:

  • uses: vimtor/action-zip-release@v1是官方Zip Release Action的正确引用,不要替换成你自己的仓库路径
  • checkout步骤必须通过ref: dev-firefox指定拉取目标分支,否则默认拉取触发工作流的分支(手动触发时可能不是dev-firefox)
  • path参数需匹配你的扩展实际代码位置,比如代码都在src/目录下,就写path: src
  • exclude参数可过滤掉.git目录、工作流配置、依赖包等无关文件,缩小压缩包体积

配置完成后,将该文件推送到仓库,当dev-firefox分支有代码推送或手动触发工作流时,就会自动生成可直接用于Firefox安装的压缩包,你可以在GitHub Actions的运行结果中下载该压缩包,也可扩展配置将其自动上传到仓库Release中。

内容的提问来源于stack exchange,提问作者Maramal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 10:35:22