bridgetownrb / bridgetown

A next-generation progressive site generator & fullstack framework, powered by Ruby
https://www.bridgetownrb.com
MIT License
1.16k stars 112 forks source link

bug: Deployment ti github pages via the default github workflow #650

Closed abepetrillo closed 8 months ago

abepetrillo commented 1 year ago

Created a bridgetown repo and decided to use the documented gh-pages workflow provided (here)[https://www.bridgetownrb.com/docs/deployment#github-pages]. After watching the build fail, I saw the following output:

Configuration file: none
  Logging at level: debug
      GitHub Pages: github-pages v227
      GitHub Pages: jekyll v3.9.2
             Theme: jekyll-theme-primer
      Theme source: /usr/local/bundle/gems/jekyll-theme-primer-0.6.0
         Requiring: jekyll-github-metadata
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
  Liquid Exception: Liquid syntax error (line 12): Unknown tag 'render' in src/index.md
/usr/local/bundle/gems/liquid-4.0.3/lib/liquid/document.rb:23:in `unknown_tag': Liquid syntax error (line 12): Unknown tag 'render' (Liquid::SyntaxError)
    from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/document.rb:[11](https://github.com/abepetrillo/abepetrillo.github.com/actions/runs/3452843605/jobs/5763008616#step:4:12):in `block in parse'
    from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/block_body.rb:32:in `parse'
    from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/document.rb:10:in `parse'
    from /usr/local/bundle/gems/liquid-4.0.3/lib/liquid/document.rb:5:in `parse'

This didn't agree with the Gemfile.lock, which is using a later version of liquid. My fix was to change:

/bin/bridgetown deploy to bundle exec bridgetown deploy. Then the script worked as expected. I can do a PR to fix the github.yml in the code, but wasn't sure if you'd prefer to fix the binary to pay attention to the lock file. Reference: https://github.com/bridgetownrb/bridgetown/blob/4e5b2a4fc4e22d339285e724cd49a50b9b545cc4/bridgetown-core/lib/bridgetown-core/configurations/gh-pages/gh-pages.yml#L29

Bridgetown Version: bridgetown 1.1.0 "Belmont"

To Reproduce Generate a new bridgetown repo then run bin/bridgetown configure gh-pages. Then push to the repo and check the github actions status

Current behavior If you check the build status, it's failed and you get the stack trace above

Expected behavior Should compile markdown with render tags correctly, and use the same gems as what is in the lockfile

Computing environment (please complete the following information):

Additional context There was also a second bug once you've fixed this, which is you need to specify the ruby version for the Setup Ruby script. We don't know what that is on the machine but might be worth adding documentation, or trying to pull it from the Gemfile if it's specified there.

jaredcwhite commented 1 year ago

Perhaps #657 will resolve this.

KonnorRogers commented 1 year ago

@jaredcwhite I know there's another issue open for GitHub pages. The problem is this:

output/_bridgetown/static

Anything with a _ at the start is ignored by GH Pages.

The way to fix this is in your output/ folder have a .nojekyll at the root.

I did this to work around it in <light-pen>

git checkout gh-pages
touch .nojekyll
git add .nojekyll
git commit -m "Add .nojekyll to gh-pages root"
git push -u origin gh-pages

This allows you to serve directories that have a _