name: Deploy Website

on:
  push:
    branches:
      - main
      - website
    paths:
      - '.github/workflows/deploy-website.yml'
      - 'website/**'

jobs:
  deploy:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./website
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - uses: actions/setup-node@v3
        with:
          node-version: 16
          cache: yarn
          cache-dependency-path: website/yarn.lock
      - run: yarn install --frozen-lockfile

      - name: Build
        run: yarn docs:build

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: website/docs/.vitepress/dist
          cname: kernelsu.org # if wanna deploy to custom domain
