name: 'CD'

on:
  push: 
    tags:
      - v*
    branches:
      - main

jobs:
  deploy:
    # runs-on: ${{ variables.RUN_ON }}
    # runs-on: macos-latest
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: 20

      - name: 🛠 setup pnpm
        uses: pnpm/action-setup@v4.0.0

      - name: ⚙ Install dependencies
        run: pnpm i
      
      - name: 🔨 Genereate project
        run: pnpm generate
      
      - name: 📂 Sync deployment
        uses: SamKirkland/FTP-Deploy-Action@v4.3.5
        with:
          server: ${{ secrets.FTP_SERVER }}
          port: ${{ secrets.FTP_PORT }}
          username: ${{ secrets.FTP_USERNAME }}
          password: ${{ secrets.FTP_PASSWORD }}
          local-dir: dist/
          server-dir: /
          exclude: .gitignore
