MarkBind / markbind

MarkBind is a tool for generating content-heavy websites from source files in Markdown format
https://markbind.org/
MIT License
135 stars 124 forks source link

Specify CACHE_DIR when deploying with GH actions #2542

Closed EltonGohJH closed 5 months ago

EltonGohJH commented 5 months ago

What is the purpose of this pull request?

Overview of changes: Fixes https://github.com/MarkBind/markbind/issues/2538 Anything you'd like to highlight/discuss: I have verified with my fork that setting cache directory will actually fix the bug. So, the bug is actually due to not being able to locate .cache folder when running markbind deploy --ci with github actions.

Link to my fork where I set the env variable and it works https://github.com/EltonGohJH/2024/commit/c6d21912e250b410294effe42f2faf190f9139c6 Testing instructions: I think we will need to release it to test it unfortunately.

Proposed commit message: (wrap lines at 72 characters) Specify cache directory so GH Actions can locate gh-pages cache folder


Checklist: :ballot_box_with_check:


Reviewer checklist:

Indicate the SEMVER impact of the PR:

At the end of the review, please label the PR with the appropriate label: r.Major, r.Minor, r.Patch.

Breaking change release note preparation (if applicable):

Give a brief explanation note about:

  • what was the old feature that was made obsolete
  • any replacement feature (if any), and
  • how the author should modify his website to migrate from the old feature to the replacement feature (if possible).
kaixin-hc commented 5 months ago

Yay!

Quick question... Is it possible for the user to set their cache directory for gh-pages to some other location? If they do this, does it become incompatible with MarkBind?

EltonGohJH commented 5 months ago

@kaixin-hc The .cache location is only just for github action and users can control it for other form of deployment like markbind deploy without the ci flag.

damithc commented 5 months ago

@EltonGohJH Thanks for the quick fix. @kaixin-hc Does this fix the deploy issue? If so, we might need to do another release.

kaixin-hc commented 5 months ago
Screenshot 2024-05-02 at 5 41 43 PM

Fixes issue after release but not before: before: https://github.com/nus-cs3281/2024/actions/runs/8919653574/job/24496208836 after: https://github.com/nus-cs3281/2024/actions/runs/8922538639/job/24504877081

damithc commented 5 months ago

hmm... I'm still facing this when deploying. Perhaps it fixed the problem for GitHub Actions only?

$ markbind deploy -n
  __  __                  _      ____    _               _
 |  \/  |   __ _   _ __  | | __ | __ )  (_)  _ __     __| |
 | |\/| |  / _` | | '__| | |/ / |  _ \  | | | '_ \   / _` |
 | |  | | | (_| | | |    |   <  | |_) | | | | | | | | (_| |
 |_|  |_|  \__,_| |_|    |_|\_\ |____/  |_| |_| |_|  \__,_|

 v5.5.2
error: The "path" argument must be of type string. Received undefined
damithc commented 5 months ago

BTW, earlier I used to find (and delete) the .cache folder in /c/Users/damithch/AppData/Roaming/npm/node_modules/markbind-cli/node_modules/gh-pages/.cache but it doesn't appear there anymore.

EltonGohJH commented 5 months ago

@damithc I tried it on my end locally that is why I didnt not implement any fixes for locally. I think if you try to set it manually in cli it should work.

set CACHE_DIR=<location of cache>

damithc commented 5 months ago

@damithc I tried it on my end locally that is why I didnt not implement any fixes for locally. I think if you try to set it manually in cli it should work.

set CACHE_DIR=<location of cache>

Thanks @EltonGohJH set CACHE_DIR=cache worked. So, do all users need to do this before deploying? Or is there way to avoid/fix the problem permanently?

EltonGohJH commented 5 months ago

@damithc I think we need to test more. It worked on my end. Maybe it does not work on windows.