name: publish
run-name: Publishing the website with a surfer
on:
  push:
    branches:
      - main

jobs:
  Build-and-publish:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version-file: '.nvmrc'
          cache: 'npm'

      - name: Install dependencies
        run: npm ci --legacy-peer-deps

      - name: Build
        run: npm run build

      - name: Publish
        run: npx surfer put --token ${{ secrets.SURFER_TOKEN }} --server datacontroller.io public/* /