From ba46f52d558c29f61f655a9b7c0447cdf6893772 Mon Sep 17 00:00:00 2001 From: Sped0n Date: Wed, 12 Nov 2025 02:32:54 +0800 Subject: [PATCH] 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 --- .github/workflows/build.yml | 22 +++++++++++++++------- .github/workflows/eslint.yml | 2 +- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 61f2c18..7be4ce1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,11 +33,14 @@ jobs: build: timeout-minutes: 30 runs-on: ubuntu-latest - name: Build + name: Build (Hugo ${{ matrix.hugo-version }}) needs: [filter] if: | github.ref == 'refs/heads/main' && github.event.repository.fork == false + strategy: + matrix: + hugo-version: ['latest', '0.114.0'] steps: - name: Set current date as env variable run: | @@ -52,7 +55,7 @@ jobs: - name: Setup Hugo uses: peaceiris/actions-hugo@v2.6.0 with: - hugo-version: '0.114.0' + hugo-version: ${{ matrix.hugo-version }} extended: true - name: Setup Dart Sass @@ -71,15 +74,17 @@ jobs: uses: actions/cache@v4 with: path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: ${{ runner.os }}-pnpm-store- + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('./pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- - name: Setup hugo cache uses: actions/cache@v4 with: path: ./exampleSite/resources - key: ${{ runner.os }}-hugo-${{ hashFiles('./exampleSite/resources') }} - restore-keys: ${{ runner.os }}-hugo- + key: ${{ runner.os }}-hugo-${{ matrix.hugo-version }}-${{ hashFiles('./exampleSite') }} + restore-keys: | + ${{ runner.os }}-hugo-${{ matrix.hugo-version }}- - name: Install dependencies run: pnpm install @@ -90,7 +95,10 @@ jobs: hugo --logLevel info --source=exampleSite --gc --minify - name: Push artifacts - if: ${{ (github.event_name == 'push' || github.event.pull_request.merged == true) && needs.filter.outputs.any_changed == 'true' }} + if: > + matrix.hugo-version == 'latest' && + (github.event_name == 'push' || github.event.pull_request.merged == true) && + needs.filter.outputs.any_changed == 'true' uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: 'ci: update bundled artifacts [skip ci]' diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 7a7fb9d..03d31da 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -54,4 +54,4 @@ jobs: if: ${{ steps.format.outcome == 'success' }} uses: stefanzweifel/git-auto-commit-action@v5 with: - commit_message: 'ci: format code' + commit_message: 'ci: format code [skip ci]'