From 21e6cd546271ed6ed094a22cd5b411a03dcc863d Mon Sep 17 00:00:00 2001 From: KTrain <69028025+KTrain5169@users.noreply.github.com> Date: Sun, 16 Aug 2026 09:28:11 +0000 Subject: [PATCH 1/2] docs: document task caching on github actions cache --- docs/guide/ci.md | 12 ++++++---- docs/guide/github-actions-cache.md | 38 ++++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/docs/guide/ci.md b/docs/guide/ci.md index d6f035d709..0b58b99bcd 100644 --- a/docs/guide/ci.md +++ b/docs/guide/ci.md @@ -46,17 +46,21 @@ The GitHub Action sets up Vite+, the required Node.js version, and the package m with: node-version: '24' cache: true + task-cache: true - run: vp install - run: vp check - run: vp test - run: vp build ``` -With `cache: true`, `setup-vp` handles dependency caching for you automatically. +### Caching -::: tip -`setup-vp` caches package-manager data. To reuse Vite Task results across CI runs, add a separate [GitHub Actions cache for Vite Task](/guide/github-actions-cache). -::: +Vite+ offers two different caching functions which interact with GitHub Actions Cache. + +- With `cache: true`, `setup-vp` handles dependency caching for you automatically. + - You can manually choose the lockfile manifest with `cache-dependency-path`, leaving it blank will auto-infer it for you. +- With `task-cache: true`, `setup-vp` handles saving and restoring the Vite+ task cache between runs for you. + - Please read the [GitHub Actions Cache](/guide/github-actions-cache) page to learn more. ## GitLab CI/CD diff --git a/docs/guide/github-actions-cache.md b/docs/guide/github-actions-cache.md index ca2c0a24d1..73df758a2b 100644 --- a/docs/guide/github-actions-cache.md +++ b/docs/guide/github-actions-cache.md @@ -4,6 +4,13 @@ Reusing Vite Task's cache across GitHub Actions runs is experimental. Test and measure it in your project before relying on it in CI. ::: +::: note `setup-vp` support +The `setup-vp` action supports saving to GitHub Actions Cache with pre-wired defaults. +Continue reading to learn how to set up. + +In either case, you will still need to follow most instructions on this page. +::: + Vite Task stores task results in `node_modules/.vite/task-cache` at the workspace root. Restore that directory in later GitHub Actions runs so Vite Task can reuse previous task results. GitHub Actions cache and Vite Task make separate decisions: @@ -61,12 +68,39 @@ vp run lint # should print "cache hit" ## 2. Restore The Cache After Install -Restore `node_modules/.vite/task-cache` after `vp install`, because package installation can recreate or modify `node_modules`. +Use the `task-cache` toggle to enable saving the task cache to GitHub Actions Cache. +It will use the key configuration seen later on this page. -Set `` below to an exact version from the [`setup-vp` releases page](https://github.com/voidzero-dev/setup-vp/releases). You can use a commit SHA instead. +Set `` below to an exact version from the [`setup-vp` releases page](https://github.com/voidzero-dev/setup-vp/releases). You can also use a commit SHA instead, which can pin the action to a specific build. See [Automatic Version Updates](/guide/ci#automatic-version-updates) to configure Dependabot or Renovate. +```yaml +name: CI + +on: + pull_request: + push: + branches: [main] + +permissions: + contents: read + +jobs: + ci: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: voidzero-dev/setup-vp@ + with: + node-version: '24' + cache: true + task-cache: true +``` + +Otherwise, remember to restore `node_modules/.vite/task-cache` after `vp install`, because package installation can recreate or modify `node_modules`. + ```yaml [.github/workflows/ci.yml] name: CI From b0ac39c78358a3f51bfe54887c4e38af84bc9a23 Mon Sep 17 00:00:00 2001 From: KTrain <69028025+KTrain5169@users.noreply.github.com> Date: Sun, 16 Aug 2026 09:50:44 +0000 Subject: [PATCH 2/2] docs: fix wrong aside type --- docs/guide/github-actions-cache.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/github-actions-cache.md b/docs/guide/github-actions-cache.md index 73df758a2b..e6104365be 100644 --- a/docs/guide/github-actions-cache.md +++ b/docs/guide/github-actions-cache.md @@ -4,7 +4,7 @@ Reusing Vite Task's cache across GitHub Actions runs is experimental. Test and measure it in your project before relying on it in CI. ::: -::: note `setup-vp` support +::: tip `setup-vp` support The `setup-vp` action supports saving to GitHub Actions Cache with pre-wired defaults. Continue reading to learn how to set up.