ci: add Firefox AMO + GitHub release workflow

This commit is contained in:
2026-03-31 14:11:05 -04:00
parent 30ba6585b0
commit 8569fa6e33
+63
View File
@@ -0,0 +1,63 @@
name: Build & Release Firefox Addon
on:
push:
branches: [main, beta] # dev is ignored
jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
# 1️⃣ Checkout code
- uses: actions/checkout@v4
# 2️⃣ Install dependencies
- name: Install deps
run: npm install -g web-ext jq
# 3️⃣ Auto version bump (numeric only)
- name: Generate version
id: version
run: |
BASE=$(jq -r .version manifest.json)
VERSION="${BASE}.${GITHUB_RUN_NUMBER}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
jq ".version = \"$VERSION\"" manifest.json > tmp.json
mv tmp.json manifest.json
# 4️⃣ Build XPI
- name: Build extension
run: web-ext build
# 5️⃣ Get built XPI path
- name: Get XPI path
id: xpi
run: |
FILE=$(ls web-ext-artifacts/*.xpi | head -n 1)
echo "file=$FILE" >> $GITHUB_OUTPUT
# 6️⃣ GitHub Release (both main and beta)
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.version }}
name: v${{ steps.version.outputs.version }}
files: ${{ steps.xpi.outputs.file }}
prerelease: ${{ github.ref == 'refs/heads/beta' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# 7️⃣ AMO deploy (main only)
- name: Sign & Upload to AMO
if: github.ref == 'refs/heads/main'
run: |
web-ext sign \
--api-key ${{ secrets.FIREFOX_API_KEY }} \
--api-secret ${{ secrets.FIREFOX_API_SECRET }} \
--source-dir . \
--artifacts-dir web-ext-artifacts \
--channel unlisted