Having a bit of a bizarre issue when attempting to build my site on Github using Github Actions. My site is comprised of a module with a theme that makes use of dart-sass and bulma.io, and the theme has a SCSS file that uses a @use
declaration to bring in Bulma,
Locally everything works fine, on my main deployment host, everything works fine, but on GitHub actions it fails with:
Error: error building site: TOCSS-DART: failed to transform "/scss/base.scss" (text/x-scss): "/tmp/hugo_cache_runner/modules/filecache/modules/pkg/mod/github.com/2315-!media/2315-theme@v0.0.0-20240628100852-5b890913708d/assets/scss/base.scss:3:0": Can't find stylesheet to import.
The top of base.scss
is the following:
@use "hugo:vars" as h;
@use "bulma" with (
$primary: h.$primary_color,
$link: h.$link_color,
$navbar-height: 4.5rem,
//$card-radius: 6px,
);
All the Bulma files are located in the assets/scss
folder in a folder named bulma
, I’ve added a post step to the workflow to run a find /tmp/hugo_cache_runner
to confirm that the files are there and they are.
The workflow is a copy of the stock one, adjusted to use a Makefile
# Run tests on the website build
name: Test - Run a test build
on:
push:
branches:
- "*"
pull_request:
# Default to bash
defaults:
run:
shell: bash
jobs:
# Test job
render-test:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.127.0
GOPRIVATE: github.com/2315-Media/*
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
steps:
- name: Setup access for private go modules
run: |
git config --global url.https://$GH_ACCESS_TOKEN@github.com/.insteadOf https://github.com/
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass
run: sudo snap install dart-sass && sudo snap alias dart-sass sass
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Build with Hugo
run: make build
The makefile:
build:
sass --version
HUGO_ENVIRONMENT=production HUGO_ENV=production hugo --gc --minify --cleanDestinationDir --logLevel INFO || find /tmp/hugo_cache_runner/
Before I attempt to create a demo repo (as its a private repo) with the issue, does anyone have any insight on to what could be causing this? I feel like using dart with modules seems to be a limited use case (from what I can see on the forums and google results) and I want to make sure I’m not missing something obvious.