GitHub Actions peaceiris/actions-gh-pages "src dir not found"
peaceiris/actions-gh-pages publishes the contents of publish_dir to the Pages branch. If that directory does not exist at action time - the build step failed or wrote elsewhere - the action has nothing to publish.
What this error means
An actions-gh-pages step fails because the publish directory does not exist, usually right after a build step that did not produce it.
github-actions
[INFO] Usage: https://github.com/peaceiris/actions-gh-pages#readme
Error: Action failed with "The directory \"public\" does not exist."Common causes
Build output missing
The static-site build did not run or failed, so publish_dir was never created.
Wrong publish_dir path
publish_dir points at public when the generator emits dist (or vice versa).
How to fix it
Build first and point publish_dir correctly
- Run the site build before the gh-pages step.
- Set publish_dir to the generator output directory.
- List the directory in a debug step if unsure.
.github/workflows/deploy.yml
- run: npm run build
- uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./distHow to prevent it
- Order build before publish in the same job.
- Keep publish_dir in sync with the build output path.
Related guides
GitHub Actions JamesIves/github-pages-deploy-action "permission denied"Fix JamesIves/github-pages-deploy-action permission-denied push errors - the token cannot push to the deploy…
GitHub Actions actions/configure-pages "Pages not enabled"Fix actions/configure-pages "Get Pages site failed" - GitHub Pages is not enabled for the repository or not s…
GitHub Actions actions/upload-pages-artifact "missing artifact"Fix deploy-pages "No artifact named github-pages-artifact found" - upload-pages-artifact did not run or point…