# Deploy VitePress site via Forgejo Actions
name: Deploy

on:
  push:
    branches: [main]
  workflow_dispatch:

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: site
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - name: Install dependencies
        run: npm ci
      - name: Build site
        run: npm run build
      - name: Deploy to Forgejo Pages
        run: |
          cd .vitepress/dist
          git init
          git checkout -b pages
          git add -A
          git config user.name "artale"
          git config user.email "arosstale1@gmail.com"
          git commit -m "deploy: $(date -u +%Y-%m-%dT%H:%M:%SZ)"
          git remote add deploy http://artale:${{ secrets.FORGEJO_TOKEN }}@185.239.209.216:3001/artale/agentic-ai-engineering.git
          git push -f deploy pages
