Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use cache when deploy on github pages #2976

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tiennm99
Copy link

@tiennm99 tiennm99 commented Mar 7, 2025

I think use GitHub Action Cache to cache resources directory is a good practice when deploy on GitHub Pages. It helps build faster, especially when we have many resource like images or scss that need to be processed.

@jmooring
Copy link
Member

jmooring commented Mar 7, 2025

This is a great idea, but I'd to change the implementation. With what you propose, will we not cache remote resource calls or modules. This is the default configuration for our file cache:

https://gohugo.io/configuration/caches/

We should instruct users to override the image cache location by placing this in their site configuration:

  [caches.images]
    dir = ':cacheDir/_gen'
    maxAge = -1

Then we need to pass the --cacheDir something flag to the build command. Please test the setup before resubmitting the PR. Thanks!

EDIT: I'm pretty sure that GitHub Pages doesn't cache the node_modules directory. So, while the body is open...

@jmooring
Copy link
Member

jmooring commented Mar 7, 2025

We should have done this a long time ago.

@tiennm99
Copy link
Author

tiennm99 commented Mar 8, 2025

Thank you for your comment. I will improve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants