This action allows you to run a few mozilla/web-ext commands
useful during add-on development. It supports lint
, build
and sign
.
Generally you can use these inputs:
cmd
: The command to run (lint, build, sign)source
: The directory the add-on is in. Forsign
, this should be the xpi file insteadartifacts
: The output directory, defaults to web-ext-artifactsverbose
: Output more debugging if set to trueprogressBar
: Enable the console progress barchannel
: The channel to use,listed
orunlisted
ignoreFiles
: A json string containing an array of files to be ignored. Web-ext by default already ignores the most frequently ignored files.
There are a few more specific to each command.
Linting supports annotations, this is great for pull requests. A token is not required for this action, though if
GITHUB_TOKEN
is in the environment, it will be used to create a check run.
name: "Lint"
on:
push:
branches:
- main
pull_request:
jobs:
lint:
name: "Lint"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v1
- name: "web-ext lint"
uses: kewisch/action-web-ext@v1
with:
cmd: lint
source: src
channel: listed
A simple web-ext build.
You can use the target
output for subsequent steps.
You can use the following extra options:
filename
: Template string for the packed extension's filename, available for download through the job's artifacts. The placeholders in braces ({...}
) are replaced by the corresponding entries in the extension'smanifest.json
. E.g."{name}-{version}.xpi"
.
name: "Build"
on:
push:
branches:
- main
pull_request:
jobs:
build:
name: "Build"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v1
- name: "web-ext build"
id: web-ext-build
uses: kewisch/action-web-ext@v1
with:
cmd: build
source: src
filename: "{name}-{version}.xpi"
ignoreFiles: '[ "package.json","package-lock.json","yarn.lock" ]'
- name: "Upload Artifact"
uses: actions/upload-artifact@v3
with:
name: target.xpi
path: ${{ steps.web-ext-build.outputs.target }}
Send the add-on for signature to AMO. To reduce the load on AMO servers, please don't use this for
on-commit or nightly builds. If you want to test your add-on you can do so in about:debugging
.
Using this for betas or releases is great though, especially in combination with
softprops/action-gh-release. Under the hood, the
action uses mozilla/sign-addon. Please note that listed
add-ons will not be signed immediately, this is indicated during the build process but is not
counted as a failure.
You can use the following extra options:
apiKey
: The API key used for signingapiSecret
: The API secret used for signingapiUrlPrefix
: The URL of the signing API, defaults to AMO productiontimeout
: The number of milliseconds to wait before giving up on a response from Mozilla's web service. Defaults to 900000 ms (15 minutes).
Changing apiUrlPrefix
will allow you to submit to
addons.thunderbird.net or using the staging/dev instance.
name: "Release"
on:
push:
tags:
- 'v*.*.*'
jobs:
sign:
name: "Release"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v1
- name: "web-ext build"
id: web-ext-build
uses: kewisch/action-web-ext@v1
with:
cmd: build
source: src
- name: "web-ext sign"
id: web-ext-sign
uses: kewisch/action-web-ext@v1
with:
cmd: sign
source: ${{ steps.web-ext-build.outputs.target }}
channel: unlisted
apiKey: ${{ secrets.AMO_SIGN_KEY }}
apiSecret: ${{ secrets.AMO_SIGN_SECRET }}
timeout: 900000
- name: "Create Release"
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ steps.web-ext-sign.outputs.target }}