name: ci

on:
  push:
    branches:
      - "main"

defaults:
  run:
    shell: bash
    working-directory: /home/mom/git/eleboog-astro

jobs:
  builder:
    runs-on: self-hosted #ubuntu-latest
    steps:
      - name: Pull code into local instance
        run: git pull

      - name: Build the Astro app
        run: pnpm build

      - name: Restart the Node server
        run: pm2 restart 0
      
      # === old workflow w/ docker shenanigans ===
      #- name: Check out code
      #  uses: actions/checkout@v4

      #- name: Set up QEMU
      #  uses: docker/setup-qemu-action@v2

      #- name: Set up context
      #  run: docker context create builders

      #- name: Set up Docker Build
      #  uses: docker/setup-buildx-action@v2
      #  with:
      #    version: latest
      #    endpoint: builders
      
      #- name: Login to Docker Registry
      #  uses: docker/login-action@v3
      #  with:
      #    registry: ${{ vars.REGISTRY_URL }}
      #    username: ${{ secrets.REGISTRY_USERNAME }}
      #    password: ${{ secrets.REGISTRY_TOKEN }}
      
      #- name: Build and push
      #  uses: docker/build-push-action@v6
      #  with:
      #    push: true
      #    platforms: linux/amd64
      #    tags: ${{ vars.REGISTRY_URL }}/${{ env.GITHUB_REPOSITORY }}:latest