Deploy Docusaurus shows README instead of website on GitHub Pages

71 views Asked by At

I've created documentation using Docusaurus and I'm trying to test it on a different remote repository:

https://github.com/jcubic/lips-website

I'm not exactly sure how to deploy to GitHub pages. Official documentation doesn't actually explain how to deploy to GitHub pages. I've found this website:

Deploy Docusaurus to GitHub Pages

This is the workflow yaml file:

name: build docs

on:
  push:
    paths:
      - 'docs/**'
      - ".github/workflows/docs.yaml"
    branches:
      - docusaurus

permissions:
  contents: write


defaults:
  run:
    working-directory: docs

jobs:
  deploy:
    name: Build Docusaurus
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 20
          cache: npm
          cache-dependency-path: docs/package-lock.json

      - name: Install dependencies
        run: npm ci

      - name: Build website
        run: npm run build

      - name: Deploy to GitHub Pages
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./docs/build
          user_name: github-actions[bot]
          user_email: 41898282+github-actions[bot]@users.noreply.github.com

But when I run this all I have is a single README file (converted to HTML) instead of my project:

https://jcubic.github.io/lips-website/

No matter what I do the GitHub action always says at the end:

  /usr/bin/git push origin gh-pages
  Everything up-to-date

It seems that the workflow deletes all the files. But I think this is intentional:

support: all built assets are getting deleted during deploy | prepare publishing assets

1

There are 1 answers

0
jcubic On

The problem was that the Docusourus workflow needed to deploy to the gh-pages branch and real GitHub pages needed to be running on the gh-pages branch.

The workflow only builds the files and pushes them into the gh-pages brunch. It doesn't publish anything, the publishing needs to happen by GitHub.