statiqdev / Statiq.Web

Statiq Web is a flexible static site generator written in .NET.
https://statiq.dev/web
Other
1.64k stars 234 forks source link

Example in Guide -> Deployment -> GitHub Pages does not work with GitHub Actions #1021

Open suchja opened 1 month ago

suchja commented 1 month ago

I tried the example as defined here and it seems not to work out of the box. From my tests (I'm no expert with GitHub Actions and GitHub Pages at all) it seems that there is an issue with the permissions.

From what I understood so far, probably the following needs to be added to the Deploy Site - GitHub Action script on the bottom of the page:

permissions:
  contents: write
  pages: write

Additionally as stated in this discussion it looks like the deployment via the pipeline does no longer work with the instructions from the Guide.

I would be willing to update the Guide as soon as it is clarified what exactly the problem is.

daveaglick commented 1 month ago

That would be awesome if you do happen to narrow down the problems you're seeing to the guide, to update the guide directly - or even just let me know what the final finding is and I'll go in and make the updates. Definitely don't want anyone else to stumble on the same problem you had if it can be avoided.

suchja commented 1 month ago

The minimal required permission is contents: write. Without this permission dotnet run fails with an unspecific error around [WARN] Deployment/Output » ExecuteIf » ExecuteIf » DeployGitHubPages » GitHub exception ForbiddenException (retry 1/5, waiting 00:00:30): Resource not accessible by integration.

Additionally it is important to mention that the gh-pages branch (or the branch used for deployment) needs to exists BEFORE the deployment is started. Otherwise something like this [WARN] Deployment/Output » ExecuteIf » ExecuteIf » DeployGitHubPages » GitHub exception NotFoundException (retry 1/5, waiting 00:00:30): Not Found can be seen.