jekyll-serif-theme icon indicating copy to clipboard operation
jekyll-serif-theme copied to clipboard

gh-pages and master branches have different functionality

Open BeniamG opened this issue 1 year ago • 6 comments

I am building a website for a student research lab with GitHub pages. This theme looks fantastic, but when I try to deploy it, I run into some issues.

The gh-pages branch automatically generates a functional website after I change baseurl in _config.yml, but it seems to lack some of the functionality or layout details available in the master branch. In particular, the teams page does not include pictures of individuals who do not have the promoted tag set to true.

Using the master branch in GitHub Pages does not work, and I think the logs show the following errors:

Warning:  github-pages can't satisfy your Gemfile's dependencies.
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
  Conversion error: Jekyll::Converters::Scss encountered an error while converting 'assets/css/style.scss':
                    Invalid CSS after " margin-top: math": expected ";", was ".div($hamburger..." on line 60
/usr/local/bundle/gems/jekyll-sass-converter-1.5.2/lib/jekyll/converters/scss.rb:123:in `rescue in convert': Invalid CSS after "  margin-top: math": expected ";", was ".div($hamburger..." on line 60 (Jekyll::Converters::Scss::SyntaxError)

and

	from /usr/local/bundle/gems/github-pages-228/bin/github-pages:6:in `<top (required)>'
	from /usr/local/bundle/bin/github-pages:23:in `load'
	from /usr/local/bundle/bin/github-pages:23:in `<main>'
/github/workspace/_sass/libraries/hamburgers/_base.scss:60: Invalid CSS after "  margin-top: math": expected ";", was ".div($hamburger..." (Sass::SyntaxError)
	from /github/workspace/_sass/libraries/hamburgers/hamburgers.scss:68
	from (sass):79

I was wondering if there was any way to deploy this site easily on GitHub such that the progress and corrections made on the main branch can be available on GitHub Pages deployment (for someone with limited knowledge about how to edit these things).

Thanks for a great theme and for any guidance you might be able to offer.

BeniamG avatar Dec 07 '23 00:12 BeniamG

I am facing the same error, both when trying to serve locally, and when trying to build (automatically) using Github Pages.

Although deployed it on main branch directly (I tried a separate gh-pages branch after seeing this post, but that didn't work either).

Search through 10+ forums, like this one:

https://github.com/mmistakes/minimal-mistakes/issues/220

  • they suggested removing front matter (---) from the main css file, but that breaks the look and feel
  • they also suggested adding "Encoding.default_external = Encoding.find('utf-8')" to "C:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\sass-3.7.4\lib\sass\engine.rb", but that didn't help either

QuillPusher avatar Jan 24 '24 14:01 QuillPusher

note that this error does not occur when building locally, without adding the following:

gem file

#gem "jekyll", "~> 4.3"
gem "github-pages", "~> 228", group: :jekyll_plugins

config.yml

baseurl: '/mybaseurl/'
dependencies:
  - gem: github-pages
    version: '~> 228'

but after adding these, I get the same error:

Warning:  github-pages can't satisfy your Gemfile's dependencies.
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
  Conversion error: Jekyll::Converters::Scss encountered an error while converting 'assets/css/style.scss':
                    Invalid CSS after " margin-top: math": expected ";", was ".div($hamburger..." on line 60
/usr/local/bundle/gems/jekyll-sass-converter-1.5.2/lib/jekyll/converters/scss.rb:123:in `rescue in convert': Invalid CSS after "  margin-top: math": expected ";", was ".div($hamburger..." on line 60 (Jekyll::Converters::Scss::SyntaxError)

QuillPusher avatar Jan 24 '24 14:01 QuillPusher

I'm trying to use this theme right now. I'm on master, latest commit, and I'm running into the same error.

missingfaktor avatar Apr 08 '24 18:04 missingfaktor

@QuillPusher What did you eventually do?

missingfaktor avatar Apr 08 '24 18:04 missingfaktor

@missingfaktor I did not use this, but I found a solution elsewhere: use Github Actions

Also, note that the "Deploy From a Branch" option in Github Page options is being retired soon, so Github Actions is your only option.

Background: https://github.com/Phlow/feeling-responsive/issues/267#issuecomment-1784804515

Sample Github Action on a similar theme

someone with a working workflow on same theme https://github.com/sieb/feeling-responsive/blob/gh-pages/.github/workflows/jekyll.yml

clone the fresh repository;
In Actions search workflows by jekyll (jekyll only) and configure, and commit jekyll.yml (change cache-version: 1)
In Actions workflows, "Deploy Jekyll site to Pages" is our process, try re-run all jobs

resultant error and its solution Error: Branch "gh-pages" is not allowed to deploy to github-pages due to environment protection rules. TL;DR: repository settings > Environments > set protection to publishing branch (e.g., gh-pages or main)

QuillPusher avatar Apr 11 '24 16:04 QuillPusher

@missingfaktor I did not use this, but I found a solution elsewhere: use Github Actions

Also, note that the "Deploy From a Branch" option in Github Page options is being retired soon, so Github Actions is your only option.

Background: Phlow/feeling-responsive#267 (comment)

Sample Github Action on a similar theme

someone with a working workflow on same theme https://github.com/sieb/feeling-responsive/blob/gh-pages/.github/workflows/jekyll.yml

clone the fresh repository;
In Actions search workflows by jekyll (jekyll only) and configure, and commit jekyll.yml (change cache-version: 1)
In Actions workflows, "Deploy Jekyll site to Pages" is our process, try re-run all jobs

resultant error and its solution Error: Branch "gh-pages" is not allowed to deploy to github-pages due to environment protection rules. TL;DR: repository settings > Environments > set protection to publishing branch (e.g., gh-pages or main)

I did the same, and it did the trick.

missingfaktor avatar Apr 11 '24 16:04 missingfaktor