Github actions runs but fails to create the public folder

I see this problem mentioned quite a bit, but it feels like the resolution is unclear.

My github action gh-pages.wml runs fine and is the standard gh-pages from Host on GitHub | Hugo .

I have a .gitignore file that looks like this:

/public/
/resources/_gen/

hugo.exe
hugo.linux
hugo.darwin

Show your workflow file for Github. Gitignore is most probably not relevant to the issue.

Edit: also, if your repo is public then show us the failed artefacts of the workflow run. That’s everything you find under the “Actions” tab of your repo.

I am literally using the exact file that Hugo has suggested (this might be slightly different than their example as I keep tinkering with it):

name: github pages

on:
  push:
    branches:
      - main  # Set a branch to deploy
  pull_request:

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true  # Fetch Hugo themes (true OR recursive)
          fetch-depth: 0    # Fetch all history for .GitInfo and .Lastmod

      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v2
        with:
          hugo-version: 'latest'
          extended: true

      - name: Build
        run: hugo --minify

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        if: github.ref == 'refs/heads/main'
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./public

No artifacts:

And here are the files:

No public folder

That workflow publishes to the gh-pages branch.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.