name: Deploy Netlify Release

defaults:
  run:
    shell: bash

env:
  CI: true

on:
  push:
    tags:
      - v**

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: false

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Repository Checkout
        uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

      - name: Set up environment
        uses: ./.github/actions/setup

      - name: Install Netlify
        run: npm install netlify-cli@17.10.1 -g

      - name: Build Actual
        run: yarn build:browser

      - name: Deploy to Netlify
        id: netlify_deploy
        run: |
          netlify deploy \
            --dir packages/desktop-client/build \
            --site ${{ secrets.NETLIFY_SITE_ID }} \
            --auth ${{ secrets.NETLIFY_API_TOKEN }} \
            --filter @actual-app/web \
            --prod
