name: Build and Deploy Next.js Site on: push: branches: [ main ] jobs: deploy: runs-on: ubuntu-latest timeout-minutes: 10 steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup Node.js and cache uses: actions/setup-node@v4 with: node-version: '18' cache: 'npm' - name: Cache Next.js build uses: actions/cache@v4 with: path: | ~/.npm ${{ github.workspace }}/.next/cache key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }} restore-keys: | ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- - name: Disable Next.js telemetry run: npx next telemetry disable - name: Install dependencies run: npm ci - name: Build and deploy run: | mv src/app/\(cms\) src/app/_cms npm run build rm -rf /var/www/sites/dave-dmg/blog/* cp -r out/* /var/www/sites/dave-dmg/blog/