mirror of
https://github.com/SoPat712/videospeed.git
synced 2026-04-21 04:42:35 -04:00
ci: add Firefox AMO + GitHub release workflow
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user