name: CI

on:
  push:
    branches: [dev]
  pull_request:
    branches: [dev]

jobs:
  build-and-publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: '24'

      - run: npm install --only=dev

      - name: web-ext lint
        run: npx web-ext lint -v

      - name: web-ext build
        run: npx web-ext build -s . -a dist --overwrite-dest
        
      - name: Unzip build artifact
        run: |
          mkdir -p disst
          unzip -o dist/*.zip -d disst

      - name: Upload build artifact
        # v4+ not supported on Gitea Actions/Forgejo, use v3 for compatibility
        uses: actions/upload-artifact@v3
        with:
          name: web-ext-build
          path: disst/**