helaili/jekyll-action

Breaks when trying to install dart-sass-embedded

ProfaneServitor opened this issue · 6 comments

When I try to deploy a site using github actions, and it uses sass, this error appears:

Fetching html-pipeline 2.14.3
Installing html-pipeline 2.14.3
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/github/workspace/vendor/bundle/ruby/2.7.0/gems/sass-embedded-1.57.1/ext/sass
/usr/local/bin/ruby -I/usr/local/lib/ruby/2.7.0/rubygems -rrubygems
/github/workspace/vendor/bundle/ruby/2.7.0/gems/rake-13.0.6/exe/rake
RUBYARCHDIR\=/github/workspace/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux-musl/2.7.0/sass-embedded-1.57.1
RUBYLIBDIR\=/github/workspace/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux-musl/2.7.0/sass-embedded-1.57.1
rake aborted!
NotImplementedError: sass_embedded for x86_64-linux-musl not available at
https://github.com/sass/dart-sass-embedded/releases/tag/1.57.1
/github/workspace/vendor/bundle/ruby/2.7.0/gems/sass-embedded-1.57.1/ext/sass/Rakefile:226:in
`default_sass_embedded'
/github/workspace/vendor/bundle/ruby/2.7.0/gems/sass-embedded-1.57.1/ext/sass/Rakefile:21:in
`block (2 levels) in <top (required)>'
/github/workspace/vendor/bundle/ruby/2.7.0/gems/sass-embedded-1.57.1/ext/sass/Rakefile:21:in
`fetch'
/github/workspace/vendor/bundle/ruby/2.7.0/gems/sass-embedded-1.57.1/ext/sass/Rakefile:21:in
`block in <top (required)>'
/github/workspace/vendor/bundle/ruby/2.7.0/gems/rake-13.0.6/exe/rake:27:in
`<main>'
Tasks: TOP => default => install => embedded.rb => sass_embedded
(See full trace by running task with --trace)

rake failed, exit code 1

github-pages.yml:

name: Build and deploy Jekyll site to GitHub Pages

on:
  push:
    branches:
      - main # or master before October 2020

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
  contents: read
  pages: write
  id-token: write

jobs:
  jekyll:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    # Use GitHub Actions' cache to shorten build times and decrease load on servers
    - uses: actions/cache@v2
      with:
        path: vendor/bundle
        key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }}
        restore-keys: |
          ${{ runner.os }}-gems-

    # Standard usage
    - uses:  helaili/jekyll-action@v2
      with:
        token: ${{ secrets.YOUR_CUSTOM_TOKEN }}

Specifying direct links to repository, or placing a copy in vendor doesn't work either. It stubbornly tries to pull from the same place anyway.

# Gemfile
gem 'sass-embedded', git: 'https://github.com/ntkme/sass-embedded-host-ruby.git' # Completely ignored

Got a similar error:

sass-embedded-1.57.1-x86_64-linux-gnu requires rubygems version >= 3.3.22, which
is incompatible with the current version, 3.1.6

it was sufficient to fix an older version of the sass converter in my local Gemfile

gem "jekyll-sass-converter", "~> 2.0"

This is because this action uses ruby:2.7-alpine Docker image, which uses musl, which cannot build Dart (dart-lang/sdk#40906), which bases Dart Sass, which bases the Ruby gem sass-embedded, which is used by jekyll-sass-converter since v3 and thus used by jekyll. There are several possible solutions:

  • On the jekyll-action side, we can use another Ruby Docker image instead of those of Alpine.
  • Use jekyll-sass-converter v2 instead of v3 (can be achieved by using an older version of jekyll).

@PaulSt got a seemingly similar but actually a totally different error.

y377 commented

hi !@UlyssesZh

On the jekyll-action side, we can use another Ruby Docker image instead of those of Alpine.

Can I replace the mirror image myself? If available, what should I do?

y377 commented

遇到了类似的错误:

sass-embedded-1.57.1-x86_64-linux-gnu requires rubygems version >= 3.3.22, which
is incompatible with the current version, 3.1.6

在我的本地修复旧版本的 sass 转换器就足够了Gemfile

gem "jekyll-sass-converter", "~> 2.0"

This method works and solves my construction problem, thank you very much!

This workaround of fixing jekyll-sass-converter to v2 is a temporary stopgap at best. v2 uses Ruby Sass, which was deprecated in 2018 and reached end of life in March 2019 (4 years ago!), and it's missing important Dart Sass features like @use, built-in modules, and scoping.

So keeping jekyll-sass-converter at v2 means the build will fail for any project that uses new Sass syntax from the past 4 years, clearly not a great solution.

In the meantime, if my project relies on Dart Sass features, are there other GitHub Actions that let me use jekyll-sass-converter v3 or do I have to write the workflow myself?

As per the updated README there won't be any new changes to this action.
Thanks!