statiqdev / Statiq.Web

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

deploying w/ GitHub pages on `ubuntu-latest` #939

Closed dochoffiday closed 2 years ago

dochoffiday commented 3 years ago

In the workflow yml file, the runs-on property needs to be set to windows-latest.

I tried using ubuntu-latest (which is the default set when creating a new action), but my pages either weren't respecting the _viewstart or the _layout, because the layout wasn't being applied.

I'm not sure if this is a bug or just something that needs to be specified in the documentation.

withinfocus commented 3 years ago

Not sure if you still have this issue or not but I just set this Action up personally:

jobs:
  build:
    name: Deploy
    runs-on: ubuntu-latest

...

      - name: .NET
        uses: actions/setup-dotnet@v1
        with:
            dotnet-version: '5.0.x'
      - run: dotnet run -- deploy
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

and it works just fine, even with .NET 5. Hope this helps.

dochoffiday commented 3 years ago

@withinfocus I tried that, which didn't build (because I'm running version 3.1 🤦‍♂️), so I also tried dotnet-version: '3.1.x', but I still had the same issue.

So I'm not sure what's going on, but running with windows-latest still works so I guess I'll just keep it as that for now. 🤷‍♂️ It was worth a shot, thanks!

jcoleson commented 2 years ago

I had the same issue.

It appears to be a problem with the ubuntu version not being able to find _Layout.cshtml with a capital L. When I renamed _Layout.cshtml to _layout.cshtml and also specified layout: _layout in my front matter is suddenly started working correctly for me in all my pages.

I'm not sure why just renaming it didn't work but I had to do both to get it to work.

daveaglick commented 2 years ago

It's probably the internal Razor engine - it has it's own layout file handling logic and gets picky about things like casing. All of that is private or internal so I can't touch it or override it (for the most part). It also wouldn't surprise me if it changed a bit from one version of Razor to another.

jcoleson commented 2 years ago

It's probably the internal Razor engine - it has its own layout file handling logic and gets picky about things like casing. All of that is private or internal, so I can't touch it or override it (for the most part). It also wouldn't surprise me if it changed a bit from one version of Razor to another.

I think the best we can do is make a note of that in the documentation somewhere. At least for me, I quick technical note on https://statiq.dev/web/deployment/github-pages mentioning that if you use a non-windows container, you may need to check casing and set the layout file in the front matter explicitly would have saved me a lot of time.

daveaglick commented 2 years ago

Doing a little cleanup. Since there's a corresponding issue for documentation, I'm going to go ahead and close this one.