Home > other >  gh-pages branch not displaying
gh-pages branch not displaying

Time:09-12

I am working on publishing a set of documentation online using GitHub Actions to deploy to GitHub pages. I first tested this by building a test repository and then making sure that I was able to build and deploy the documentation before adding all of the files to my main project.

Goal: I am trying to deploy these docs/host them on the project's GitHub pages.

I have two repos the testdocs repo and the mainproject repo. Once I was sure that it was working correctly on the testdocs repo I just copied over the same code to the main project. Unfortunately, this did not work.

I have narrowed it down to the fact that in the docstesting repo, I have two branches, one for the main and another for gh-pages. I am able to select either one of these then in the GitHub pages tab under settings. The main repo only has the main branch and does not have a second branch. I think this might be causing the problem. What is confusing to me is 1) they are using the exact same code and 2) I thought this was supposed to be automatically deployed by the GitHub Action.

Does anyone have any idea what might be going wrong here? Or, alternatively, perhaps an explanation as to why/how my main project is not getting a gh-pages branch?

The files of interest are the docs directory and the sphinx.yml file in the .github/workflows directory.

CodePudding user response:

Considering your .github/workflows/sphinx.yml uses peaceiris/actions-gh-pages with:

if: github.ref == 'refs/heads/main'

It should deploy the main branch in both repositories.
Try and add " Another GitHub Pages Branch" set to main:

- name: Deploy
  uses: peaceiris/actions-gh-pages@v3
  with:
    github_token: ${{ secrets.GITHUB_TOKEN }}
    publish_branch: your-branch  # default: gh-pages  <======

Ethan confirms in the comments an issue with branch name:

Your answer drew my attention to the fact that I had set it to "main" but instead needed to set it to "master", as this is the branch that the original code was on.

  • Related