From 8569fa6e33f1c16cd417b687f02acd97802453dc Mon Sep 17 00:00:00 2001 From: Josh Patra Date: Tue, 31 Mar 2026 14:11:05 -0400 Subject: [PATCH] ci: add Firefox AMO + GitHub release workflow --- .github/workflows/deploy.yml | 63 ++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..12e090c --- /dev/null +++ b/.github/workflows/deploy.yml @@ -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