Skip to content

Commit ba46f52

Browse files
committed
ci: build with multiple Hugo versions and update caches
Add matrix strategy for 'latest' and '0.114.0' in build job. Update pnpm and Hugo cache keys for better reliability. Push artifacts only for 'latest' version. Add [skip ci] to format commit message. Signed-off-by: Sped0n <[email protected]>
1 parent 48eaa9d commit ba46f52

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

.github/workflows/build.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,14 @@ jobs:
3333
build:
3434
timeout-minutes: 30
3535
runs-on: ubuntu-latest
36-
name: Build
36+
name: Build (Hugo ${{ matrix.hugo-version }})
3737
needs: [filter]
3838
if: |
3939
github.ref == 'refs/heads/main' &&
4040
github.event.repository.fork == false
41+
strategy:
42+
matrix:
43+
hugo-version: ['latest', '0.114.0']
4144
steps:
4245
- name: Set current date as env variable
4346
run: |
@@ -52,7 +55,7 @@ jobs:
5255
- name: Setup Hugo
5356
uses: peaceiris/[email protected]
5457
with:
55-
hugo-version: '0.114.0'
58+
hugo-version: ${{ matrix.hugo-version }}
5659
extended: true
5760

5861
- name: Setup Dart Sass
@@ -71,15 +74,17 @@ jobs:
7174
uses: actions/cache@v4
7275
with:
7376
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
74-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
75-
restore-keys: ${{ runner.os }}-pnpm-store-
77+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('./pnpm-lock.yaml') }}
78+
restore-keys: |
79+
${{ runner.os }}-pnpm-store-
7680
7781
- name: Setup hugo cache
7882
uses: actions/cache@v4
7983
with:
8084
path: ./exampleSite/resources
81-
key: ${{ runner.os }}-hugo-${{ hashFiles('./exampleSite/resources') }}
82-
restore-keys: ${{ runner.os }}-hugo-
85+
key: ${{ runner.os }}-hugo-${{ matrix.hugo-version }}-${{ hashFiles('./exampleSite') }}
86+
restore-keys: |
87+
${{ runner.os }}-hugo-${{ matrix.hugo-version }}-
8388
8489
- name: Install dependencies
8590
run: pnpm install
@@ -90,7 +95,10 @@ jobs:
9095
hugo --logLevel info --source=exampleSite --gc --minify
9196
9297
- name: Push artifacts
93-
if: ${{ (github.event_name == 'push' || github.event.pull_request.merged == true) && needs.filter.outputs.any_changed == 'true' }}
98+
if: >
99+
matrix.hugo-version == 'latest' &&
100+
(github.event_name == 'push' || github.event.pull_request.merged == true) &&
101+
needs.filter.outputs.any_changed == 'true'
94102
uses: stefanzweifel/git-auto-commit-action@v5
95103
with:
96104
commit_message: 'ci: update bundled artifacts [skip ci]'

.github/workflows/eslint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ jobs:
5454
if: ${{ steps.format.outcome == 'success' }}
5555
uses: stefanzweifel/git-auto-commit-action@v5
5656
with:
57-
commit_message: 'ci: format code'
57+
commit_message: 'ci: format code [skip ci]'

0 commit comments

Comments
 (0)