Update Hugo module dependencies #6
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Lint & build | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - v* | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| env: | |
| CACHE_KEY: 'hugo-hinode-template' | |
| permissions: | |
| pull-requests: read | |
| contents: read | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: lts/* | |
| cache: 'npm' | |
| cache-dependency-path: '**/package-lock.json' | |
| # [24/AUG/23] Adjusted from npm ci to prevent EBADPLATFORM error due to fsevents | |
| - name: Install npm | |
| run: npm i | |
| - name: Lint the source files | |
| run: npm run lint | |
| build: | |
| needs: lint | |
| strategy: | |
| matrix: | |
| os: [macos-latest, windows-latest, ubuntu-latest] | |
| # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
| node-version: [22.x, 24.x] | |
| include: | |
| - os: ubuntu-latest | |
| hugo_cachedir: '/tmp/hugo_cache_runner' | |
| - os: macos-latest | |
| hugo_cachedir: '/Users/runner/Library/Caches/hugo_cache' | |
| - os: windows-latest | |
| hugo_cachedir: '~\AppData\Local\hugo_cache' | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| HUGO_CACHEDIR: ${{ matrix.hugo_cachedir }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v6 | |
| - name: Install Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: "stable" | |
| - name: Set up Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| cache-dependency-path: '**/package-lock.json' | |
| - name: Install Dart Sass | |
| env: | |
| DART_SASS_VERSION: "1.98.0" | |
| run: | | |
| if [ "$RUNNER_OS" == "Linux" ]; then | |
| curl -fsSL "https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz" \ | |
| | tar -xz -C "$HOME" | |
| echo "$HOME/dart-sass" >> $GITHUB_PATH | |
| elif [ "$RUNNER_OS" == "macOS" ]; then | |
| brew install sass/sass/sass | |
| elif [ "$RUNNER_OS" == "Windows" ]; then | |
| choco install sass | |
| fi | |
| shell: bash | |
| # [24/AUG/23] Adjusted from npm ci for non-macOS to prevent EBADPLATFORM error due to fsevents | |
| - name: Perform clean install of npm | |
| run: | | |
| if [ "$RUNNER_OS" == "macOS" ]; then | |
| npm ci | |
| else | |
| npm i | |
| fi | |
| shell: bash | |
| # On Windows, HUGO_CACHEDIR is initialised from the matrix as '~\AppData\Local\hugo_cache'. | |
| # Hugo requires an absolute path, so expand ~ to %LOCALAPPDATA% before using the cache. | |
| - name: Expand Hugo cache directory on Windows | |
| if: runner.os == 'Windows' | |
| run: echo "HUGO_CACHEDIR=$env:LOCALAPPDATA\hugo_cache" >> $env:GITHUB_ENV | |
| shell: pwsh | |
| # Cache Hugo cachedir and resourcedir (configured in config/ci/hugo.toml) for each OS. | |
| # Rolling key restores the previous snapshot as a warm start, then saves a fresh one after build. | |
| # No additional content-based invalidation is needed; Hugo uses checksums itself. | |
| - name: Use Hugo cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ env.HUGO_CACHEDIR }} | |
| key: ${{ runner.os }}-${{ env.CACHE_KEY }}-${{ github.run_id }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ env.CACHE_KEY }}- | |
| - name: Display environment | |
| run: npm run env | |
| - name: Build main site | |
| run: npm run build:cache |