Update the Mozilla Firefox Update JSON File after a Release for Self Hosted Extensions.
| Input | Default | Short Description of the Input Value |
|---|---|---|
| url | Required | Update URL w/ {version} Template |
| update | update.json |
Update JSON File Location |
| manifest | manifest.json |
* Manifest File Location |
| version | - | * Override Version from manifest |
| addon_id | - | * Override Addon ID from manifest |
url - You can provide a fully formatted URL or use the {version} template string.
manifest - If provided the version and addon_id will be parsed from this file.
version - Manually specify the version to use for {version} in url.
addon_id - Manually specify the addon_id to use for update JSON file.
If not provided this is parsed from the manfiest key: browser_specific_settings.gecko.id
- name: 'Mozilla Addon Update'
uses: cssnr/mozilla-addon-update-action@v1
with:
url: 'https://github.com/cssnr/link-extractor/releases/download/{version}/link_extractor-firefox.xpi'| Output | Description |
|---|---|
| url | Update URL Result |
| result | Update JSON Result |
- name: 'Mozilla Addon Update'
id: update
uses: cssnr/mozilla-addon-update-action@v1
with:
url: 'https://github.com/cssnr/link-extractor/releases/download/{version}/link_extractor-firefox.xpi'
- name: 'Echo Outputs'
run: |
echo '${{ steps.update.outputs.url }}'
echo '${{ steps.update.outputs.result }}'Tip
The addon will now attempt to create the file if it does not exist.
This action expects the input_update JSON file to exist, be valid JSON and have a matching addon_id entry.
At a minimum, add a file similar to this where link-extractor@cssnr.com is your Addon ID:
{
"addons": {
"link-extractor@cssnr.com": {
"updates": []
}
}
}For more details see: src/main.py.
Mozilla Documentation: https://extensionworkshop.com/documentation/manage/updating-your-extension/
Basic Example with All Inputs:
- name: 'Mozilla Addon Update'
uses: cssnr/mozilla-addon-update-action@v1
with:
url: 'https://github.com/cssnr/link-extractor/releases/download/{version}/link_extractor-firefox.xpi'
update: update.json
manifest: manifest.json
version: '1.0.0'
addon_id: link-extractor@cssnr.comSimple Example:
name: 'Mozilla Addon Update'
on:
workflow_dispatch:
release:
types: [published]
jobs:
mozilla-update:
name: 'Mozilla Addon Update'
runs-on: ubuntu-latest
timeout-minutes: 5
if: ${{ github.event_name == 'release' }}
steps:
- name: 'Checkout'
uses: actions/checkout@v6
- name: 'Mozilla Addon Update'
uses: cssnr/mozilla-addon-update-action@v1
with:
url: 'https://github.com/cssnr/link-extractor/releases/download/{version}/link_extractor-firefox.xpi'Full Example:
name: 'Release'
on:
release:
types: [published]
env:
PACKAGE_NAME: geoimage
MOZILLA_ID: geo-image@cssnr.com
UPDATE_JSON: update.json
jobs:
build:
name: 'Build'
uses: ./.github/workflows/build.yaml
secrets: inherit
with:
version: ${{ github.event.release.tag_name }} # github.ref_name can be empty
permissions:
contents: write
publish-mozilla:
# https://mozilla.github.io/addons-server/topics/api/index.html
name: 'Publish Mozilla'
if: ${{ !github.event.release.prerelease }}
runs-on: ubuntu-latest
timeout-minutes: 15
needs: [build]
permissions:
contents: write
environment:
name: mozilla
url: '${{ github.server_url }}/${{ github.repository }}/releases/latest/download/${{ env.PACKAGE_NAME }}-firefox.xpi'
steps:
- name: 'Download Artifacts'
uses: actions/download-artifact@v8
with:
name: artifacts
# NOTE: This installs web-ext using npx
- name: 'Sign Mozilla Addon'
# https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#web-ext-sign
env:
FIREFOX_API_KEY: ${{ secrets.FIREFOX_API_KEY }}
FIREFOX_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }}
run: |
npx web-ext sign --no-input \
--api-key="${FIREFOX_API_KEY}" \
--api-secret="${FIREFOX_API_SECRET}" \
--channel=unlisted \
--source-dir="firefox-mv3" \
--upload-source-code="${{ env.PACKAGE_NAME }}-${{ github.event.release.tag_name }}-sources.zip"
- name: 'Upload to Release'
uses: cssnr/upload-release-action@v1
with:
overwrite: true
globs: web-ext-artifacts/*.xpi
names: '${{ env.PACKAGE_NAME }}-firefox.xpi'
update-mozilla:
name: 'Update Mozilla'
if: ${{ !github.event.release.prerelease }}
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [publish-mozilla]
permissions:
contents: write
steps:
- name: 'Checkout'
uses: actions/checkout@v6
with:
persist-credentials: false
- name: 'Mozilla Addon Update'
uses: cssnr/mozilla-addon-update-action@v1
with:
url: 'https://github.com/${{ github.repository }}/releases/download/{version}/${{ env.PACKAGE_NAME }}-firefox.xpi'
addon_id: ${{ env.MOZILLA_ID }}
version: ${{ github.event.release.tag_name }}
- name: 'Commit Action'
id: commit
uses: suzuki-shunsuke/commit-action@f12e2d628a4ab72dcefe7890ae07e8dbf1e201b9 # v0.1.1
with:
branch: master
commit_message: 'Bump ${{ env.UPDATE_JSON }} to ${{ github.event.release.tag_name }}'
#github_token: ${{ steps.app.outputs.token }}
app_id: 146360
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
fail_on_self_push: falseFor more examples, you can check out other projects using this action:
https://github.com/cssnr/mozilla-addon-update-action/network/dependents
The following rolling tags are maintained.
| Version Tag | Rolling | Bugs | Feat. | Name | Target | Example |
|---|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | Major | vN.x.x |
vN |
|
| ✅ | ✅ | ❌ | Minor | vN.N.x |
vN.N |
|
| ❌ | ❌ | ❌ | Micro | vN.N.N |
vN.N.N |
You can view the release notes for each version on the releases page.
The Major tag is recommended. It is the most up-to-date and always backwards compatible. Breaking changes would result in a Major version bump. At a minimum you should use a Minor tag.
If you run into any issues or need help getting started, please do one of the following:
If you would like to submit a PR, please review the CONTRIBUTING.md.
Please consider making a donation to support the development of this project and additional open source projects.
Additionally, you can support other GitHub Actions I have published:
- Stack Deploy Action
- Portainer Stack Deploy Action
- Docker Context Action
- Actions Up Action
- Webstore Publish Action
- Rhysd Actionlint Action
- Zensical Action
- VirusTotal Action
- Homebrew Action
- Mirror Repository Action
- Update Version Tags Action
- Docker Tags Action
- TOML Action
- Update JSON Value Action
- JSON Key Value Check Action
- Parse Issue Form Action
- Cloudflare Purge Cache Action
- Mozilla Addon Update Action
- Package Changelog Action
- NPM Outdated Check Action
- Label Creator Action
- Algolia Crawler Action
- Create Pull Action
- Upload Release Action
- Check Build Action
- Web Request Action
- Get Commit Action
❔ Unpublished Actions
These actions are not published on the Marketplace, but may be useful.
- cssnr/create-files-action - Create various files from templates.
- cssnr/draft-release-action - Keep a draft release ready to publish.
- cssnr/env-json-action - Convert env file to json or vice versa.
- cssnr/push-artifacts-action - Sync files to a remote host with rsync.
- smashedr/update-release-notes-action - Update release notes.
- smashedr/combine-release-notes-action - Combine release notes.
📝 Template Actions
These are basic action templates that I use for creating new actions.
- javascript-action - JavaScript
- typescript-action - TypeScript
- py-test-action - Dockerfile Python
- test-action-uv - Dockerfile Python UV
- docker-test-action - Docker Image Python
Note: The docker-test-action builds, runs and pushes images to GitHub Container Registry.
For a full list of current projects visit: https://cssnr.github.io/
