name: Continuous Deployment

on:
  push:
    tags:
      - v*

jobs:
  lint:
    runs-on: linux
    steps:
      - name: Checkout repo
        uses: actions/checkout@v5
      - name: Run linter
        run: make lint

  deploy-chrome:
    needs: lint
    runs-on: linux
    steps:
      - name: Checkout repo
        uses: actions/checkout@v5
      - name: Deploy project to Chrome Webstore
        env:
          CLIENT_ID: ${{ vars.CHROME_CLIENT_ID }}
          CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }}
          EXTENSION_ID: ${{ vars.CHROME_EXTENSION_ID }}
          REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }}
        run: make deploy_chrome

  deploy-firefox:
    needs: lint
    runs-on: linux
    steps:
      - name: Checkout repo
        uses: actions/checkout@v5
      - name: Deploy project to Firefox Addons
        env:
          WEB_EXT_API_KEY: ${{ vars.FIREFOX_API_KEY }}
          WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }}
        run: make deploy_firefox
