CI: Upgrade GitHub Actions #116
This file contains 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: Test | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- "README.md" | |
pull_request: | |
paths-ignore: | |
- "README.md" | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: | |
- '20.x' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: Install npm dependencies | |
run: npm ci | |
- name: Lint | |
run: npm run lint | |
test-hugo: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
hugo: | |
- '0.54.0' # min version | |
- '0.58.2' # https://github.com/gohugoio/hugoThemes/issues/682 | |
- '0.59.1' # last major version without goldmark renderer | |
- '0.60.1' # first major version with goldmark renderer | |
- '0.76.5' # https://github.com/gohugoio/hugo/issues/7822 | |
# - '0.80.0' # https://github.com/gohugoio/hugo/issues/8340 | |
- '0.86.1' # https://github.com/gohugoio/hugo/issues/9150 | |
- '0.93.3' # https://github.com/gohugoio/hugo/commit/837fdfdf45014e3d5ef3b00b01548b68a4489c5f | |
- 'latest' | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
# https://github.com/peaceiris/actions-hugo (community action) | |
- name: Run Hugo ${{ matrix.hugo }} | |
uses: peaceiris/actions-hugo@v3 | |
with: | |
hugo-version: ${{ matrix.hugo }} | |
# extended: true | |
- name: Build with Hugo ${{ matrix.hugo }} | |
working-directory: exampleSite | |
run: | | |
function ver { printf "%03d%03d%03d" $(echo "$1" | tr '.' ' '); } | |
HUGO_VERSION=$(hugo version | grep -Eo '[0-9]\.[0-9]+\.[0-9]+') | |
# The option changed in 0.93.0: https://github.com/gohugoio/hugo/releases/tag/v0.93.0 | |
I18N_OPT=$([ $(ver $HUGO_VERSION) -lt $(ver 0.93.0) ] && echo "--i18n-warnings" || echo "--printI18nWarnings") | |
# The option deprecated in v0.114.0 (WARNs >= 0.120.0): https://github.com/gohugoio/hugo/releases/tag/v0.114.0 | |
LOG_OPT=$([ $(ver $HUGO_VERSION) -lt $(ver 0.114.0) ] && echo "--verbose" || echo "--logLevel info") | |
HUGO_THEME="Binario" hugo --themesDir ../.. $I18N_OPT $LOG_OPT |