mirror of
https://github.com/SoPat712/videospeed.git
synced 2026-04-24 21:42:53 -04:00
64 lines
1.8 KiB
YAML
64 lines
1.8 KiB
YAML
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
|
|
|
|
# 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
|