name: extension on: push: branches: [dev, main] paths: ['extension/**'] workflow_dispatch: jobs: lint: runs-on: python-ci container: image: node:22-bookworm-slim steps: - uses: actions/checkout@v4 - name: Install web-ext run: cd extension && npm install --no-save --no-audit --no-fund - name: Lint run: cd extension && npm run lint sign-and-publish: needs: lint if: github.ref == 'refs/heads/main' runs-on: python-ci container: image: node:22-bookworm-slim steps: - uses: actions/checkout@v4 with: token: ${{ secrets.RELEASE_TOKEN }} - name: Install web-ext + git run: | apt-get update && apt-get install -y --no-install-recommends git ca-certificates cd extension && npm install --no-save --no-audit --no-fund - name: Sign XPI run: cd extension && npm run sign env: WEB_EXT_API_KEY: ${{ secrets.MOZILLA_AMO_JWT_KEY }} WEB_EXT_API_SECRET: ${{ secrets.MOZILLA_AMO_JWT_SECRET }} - name: Commit signed XPI to frontend/public/extension/ run: | set -e # AMO renames signed XPIs using its internal addon-id-safe-string # (e.g. 997017ca3e104e30a75a-1.0.1.xpi), NOT our gecko ID. The # original 'fabledcurator-*' glob never matched and the step # exited 1 even on a successful sign (operator-flagged # 2026-05-25). Match any *.xpi in the artifacts dir — fresh # CI runner means there's exactly one — and rename it on copy # so the FC server's whitelist (backend/app/frontend.py expects # 'fabledcurator-*.xpi') keeps working. XPI=$(ls extension/web-ext-artifacts/*.xpi 2>/dev/null | head -1) if [ -z "$XPI" ]; then echo "No XPI produced by web-ext sign — exiting" ls -la extension/web-ext-artifacts/ || true exit 1 fi VERSION=$(grep -E '"version"' extension/package.json | head -1 | sed -E 's/.*"version"[[:space:]]*:[[:space:]]*"([^"]+)".*/\1/') DEST="frontend/public/extension/fabledcurator-${VERSION}.xpi" mkdir -p frontend/public/extension # Wipe any prior versions so the directory doesn't grow each release. rm -f frontend/public/extension/fabledcurator-*.xpi cp "$XPI" "$DEST" cp "$XPI" "frontend/public/extension/fabledcurator-latest.xpi" git config user.name "FC extension CI" git config user.email "noreply@fabledsword.com" git add frontend/public/extension/ if git diff --cached --quiet; then echo "No changes to commit" else git commit -m "ext: publish signed XPI fabledcurator-${VERSION}.xpi" git push origin HEAD:main fi