summaryrefslogtreecommitdiffstats
path: root/.github/workflows/lint-build.yml
diff options
context:
space:
mode:
authorAnoduck <9925396+anoduck@users.noreply.github.com>2024-09-08 14:54:54 +0000
committerGitHub <noreply@github.com>2024-09-08 14:54:54 +0000
commitd2a0fd14e05ef6b0b9fca454f8996faf86f94204 (patch)
tree242f822be67c179618f1e2aabcea60c172f4f6e0 /.github/workflows/lint-build.yml
Initial commit
Diffstat (limited to '.github/workflows/lint-build.yml')
-rw-r--r--.github/workflows/lint-build.yml98
1 files changed, 98 insertions, 0 deletions
diff --git a/.github/workflows/lint-build.yml b/.github/workflows/lint-build.yml
new file mode 100644
index 0000000..7228fef
--- /dev/null
+++ b/.github/workflows/lint-build.yml
@@ -0,0 +1,98 @@
+name: Lint & build
+on:
+ workflow_dispatch:
+ push:
+ tags:
+ - v*
+ branches: [ main ]
+ pull_request:
+ branches: [ main ]
+
+env:
+ CACHE_KEY: 'hugo-hinode-template'
+ CACHE_PATH_DEBIAN: '/tmp/hugo_cache_runner'
+ CACHE_PATH_WIN: '~\AppData\Local\hugo_cache'
+ CACHE_PATH_MAC: '/Users/runner/Library/Caches/hugo_cache'
+
+jobs:
+ lint:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Check out repository
+ uses: actions/checkout@v4
+
+ - name: Set up Node.js
+ uses: actions/setup-node@v4
+ 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: [20.x, 22.x]
+
+ runs-on: ${{ matrix.os }}
+
+ steps:
+ - name: Check out repository
+ uses: actions/checkout@v4
+
+ - name: Install Go
+ uses: actions/setup-go@v5
+ with:
+ go-version: ">1.0.0"
+
+ - name: Set up Node.js ${{ matrix.node-version }}
+ uses: actions/setup-node@v4
+ with:
+ node-version: ${{ matrix.node-version }}
+ cache: 'npm'
+ cache-dependency-path: '**/package-lock.json'
+
+ - name: Install Dart Sass
+ run: |
+ if [ "$RUNNER_OS" == "Linux" ]; then
+ sudo snap install dart-sass
+ 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
+
+ # Cache Hugo cachedir and resourcedir (configured in config/ci/hugo.toml) for each OS
+ # No additional cache invalidation is needed, Hugo uses checksums itself
+ - name: Use Hugo cache
+ uses: actions/cache@v4
+ with:
+ path: ${{ runner.os == 'Windows' && env.CACHE_PATH_WIN || runner.os == 'macOS' && env.CACHE_PATH_MAC || env.CACHE_PATH_DEBIAN }}
+ key: ${{ runner.os }}-${{ env.CACHE_KEY }}
+ restore-keys: |
+ ${{ runner.os }}-${{ env.CACHE_KEY }}
+
+ - name: Build main site
+ run: npm run build:cache