replaced hashing function for caching
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 18s
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 18s
This commit is contained in:
@@ -16,6 +16,17 @@ jobs:
|
|||||||
submodules: false # Don't fetch submodules yet
|
submodules: false # Don't fetch submodules yet
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
# Setup Go for the go-hashfiles action
|
||||||
|
- uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: '1.20'
|
||||||
|
|
||||||
|
# Generate hash for submodules
|
||||||
|
- uses: actions/go-hashfiles@v0.0.1
|
||||||
|
id: submodules-hash
|
||||||
|
with:
|
||||||
|
patterns: .gitmodules
|
||||||
|
|
||||||
# Cache the submodule content
|
# Cache the submodule content
|
||||||
- name: Cache submodules
|
- name: Cache submodules
|
||||||
id: cache-submodules
|
id: cache-submodules
|
||||||
@@ -24,7 +35,7 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
.git/modules
|
.git/modules
|
||||||
themes/blowfish
|
themes/blowfish
|
||||||
key: ${{ runner.os }}-submodules-${{ hashFiles('.gitmodules') }}
|
key: ${{ runner.os }}-submodules-${{ steps.submodules-hash.outputs.hash }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-submodules-
|
${{ runner.os }}-submodules-
|
||||||
|
|
||||||
@@ -33,12 +44,18 @@ jobs:
|
|||||||
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
||||||
run: git submodule update --init --recursive
|
run: git submodule update --init --recursive
|
||||||
|
|
||||||
|
# Generate hash for Hugo dependencies
|
||||||
|
- uses: actions/go-hashfiles@v0.0.1
|
||||||
|
id: hugo-deps-hash
|
||||||
|
with:
|
||||||
|
patterns: '**/go.sum'
|
||||||
|
|
||||||
# Cache Hugo dependencies and modules
|
# Cache Hugo dependencies and modules
|
||||||
- name: Cache Hugo dependencies
|
- name: Cache Hugo dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: /tmp/hugo_cache
|
path: /tmp/hugo_cache
|
||||||
key: ${{ runner.os }}-hugo-${{ hashFiles('**/go.sum') }}
|
key: ${{ runner.os }}-hugo-${{ steps.hugo-deps-hash.outputs.hash }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-hugo-
|
${{ runner.os }}-hugo-
|
||||||
|
|
||||||
@@ -48,24 +65,41 @@ jobs:
|
|||||||
hugo-version: "latest"
|
hugo-version: "latest"
|
||||||
extended: true
|
extended: true
|
||||||
|
|
||||||
|
# Generate hash for Hugo resources
|
||||||
|
- uses: actions/go-hashfiles@v0.0.1
|
||||||
|
id: hugo-resources-hash
|
||||||
|
with:
|
||||||
|
patterns: |-
|
||||||
|
content/**
|
||||||
|
layouts/**
|
||||||
|
static/**
|
||||||
|
themes/**
|
||||||
|
config/**
|
||||||
|
|
||||||
# Cache resources but not public to prevent infinite loops
|
# Cache resources but not public to prevent infinite loops
|
||||||
- name: Cache Hugo resources
|
- name: Cache Hugo resources
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: resources/_gen
|
path: resources/_gen
|
||||||
key: ${{ runner.os }}-hugo-resources-${{ hashFiles('content/**', 'layouts/**', 'static/**', 'themes/**', 'config/**') }}
|
key: ${{ runner.os }}-hugo-resources-${{ steps.hugo-resources-hash.outputs.hash }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-hugo-resources-
|
${{ runner.os }}-hugo-resources-
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: hugo --minify --buildFuture
|
run: hugo --minify --buildFuture
|
||||||
|
|
||||||
|
# Generate hash for apt cache
|
||||||
|
- uses: actions/go-hashfiles@v0.0.1
|
||||||
|
id: apt-hash
|
||||||
|
with:
|
||||||
|
patterns: '**/deploy.yml'
|
||||||
|
|
||||||
# Cache apt packages
|
# Cache apt packages
|
||||||
- name: Cache apt packages
|
- name: Cache apt packages
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: /var/cache/apt/archives
|
path: /var/cache/apt/archives
|
||||||
key: ${{ runner.os }}-apt-${{ hashFiles('**/deploy.yml') }}
|
key: ${{ runner.os }}-apt-${{ steps.apt-hash.outputs.hash }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-apt-
|
${{ runner.os }}-apt-
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user