chipzoller / hugo-clarity

A theme for Hugo based on VMware Clarity
Other
582 stars 267 forks source link

Error When Serving With GitHub Pages #233

Closed joesan closed 2 years ago

joesan commented 2 years ago

I have checked all the prerequisites below and I'm yet experiencing a problem

Describe the bug

I tried out the template and immediately used it for my blogging website that I have been running so far with Zola. Everything worked fine locally on my machine. I was able to serve the content using hugo server command, but I wanted to use GitHub pages to render the contents of my hugo --minify command.

Desktop (please complete the following information):

Here is my repo: https://github.com/joesan/bigElectrons

What I'm trying to do is basically the following:

  1. Upon commit to the master branch, trigger the GitHub actions
  2. Checkout a copy of the master branch, install hugo, build and copy the contents of the public folder to a new branch called gh-pages
  3. The gh-pages is then configured to serve the GitHub pages
  4. Using my custom domain name, the page is redirected to GitHub pages when called.

Here is what I'm doing in my main.yaml:

      - name: Generate HTML
        run: hugo --minify
      - name: Commit and push to target branch
        run: |-
          hugo version
          echo "PRINTING CURRENT DIRECTORY......"
          pwd
          echo "PRINTING LS DIRECTORY......"
          ls -la
          cd public
          echo "PRINTING LS PUBLIC DIRECTORY......"
          ls -la
          git config --global user.email "workflow-bot@bigelectrons.com"
          git config --global user.name "workflow-bot"
          git checkout --orphan $TARGET_BRANCH
          mv public ..
          rm -rf *
          mv ../public/* .
          touch .nojekyll
          touch README.md
          echo 'https://www.bigelectrons.com - SITE GENERATED USING HUGO' > README.md
          touch CNAME
          echo 'bigelectrons.com' > CNAME
          rm -rf .github/
          rm -Rf .gitignore
          rm -Rf .idea
          git add .
          git commit -m "generated using hugo build"
          git push --set-upstream origin $TARGET_BRANCH --force

Strangely, I'm not seeing any html files being generated at all. If I call my URL bigelectrons.com, I get to see an xml.

joesan commented 2 years ago

Resolved! Ended up using the default GitHub actions from the Hugo documentation. Though it worked fine, I wanted my version to work, but nevertheless it is resolved for me.

onweru commented 2 years ago

@joesan, please consider opening a discussion next time, instead of an issue.