name: turso-serverless

on:
  workflow_dispatch:
  push:
    branches: [ main ]
    paths:
      - 'packages/turso-serverless/**'
      - '.github/workflows/turso-serverless.yml'
  pull_request:
    branches: [ main ]
    paths:
      - 'packages/turso-serverless/**'
      - '.github/workflows/turso-serverless.yml'

env:
  working-directory: packages/turso-serverless

jobs:
  build:
    runs-on: blacksmith-4vcpu-ubuntu-2404
    timeout-minutes: 20
    defaults:
      run:
        working-directory: ${{ env.working-directory }}
    
    steps:
    - uses: actions/checkout@v4
    
    - name: Setup Node.js
      uses: useblacksmith/setup-node@v5
      with:
        node-version: '20'
        cache: 'npm'
        cache-dependency-path: ${{ env.working-directory }}/package-lock.json
    
    - name: Install dependencies
      run: npm ci
    
    - name: Build
      run: npm run build
