Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-pages and master branches have different functionality #91

Open
BeniamG opened this issue Dec 7, 2023 · 6 comments
Open

gh-pages and master branches have different functionality #91

BeniamG opened this issue Dec 7, 2023 · 6 comments

Comments

@BeniamG
Copy link

BeniamG commented Dec 7, 2023

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.

@QuillPusher
Copy link

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:

mmistakes/minimal-mistakes#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
Copy link

QuillPusher commented Jan 24, 2024

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)

@missingfaktor
Copy link

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

@missingfaktor
Copy link

@QuillPusher What did you eventually do?

@QuillPusher
Copy link

@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)

@missingfaktor
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants