Files
ci-cache/README.md
T
bot 881a827f46
ci / test (pull_request) Failing after 2s
cd / tag (pull_request) Successful in 12s
調整:ci/cd 一致化(action-ci 自動偵測、action-cd)、版本計算抽到 next-version
2026-11-05 04:12:39 +00:00

29 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ci-cache
包一層 `actions/cache`,預設快取 workspace 的 `.ci-home`(Go 模組與建置快取、npm、工具鏈、rod 下載的 Chromium)。key 由呼叫端用 `hashFiles` 算好傳入。
## 用法
版本由呼叫端的 Gitea Actions 變數決定(例如 `vars.ACTION_CI_CACHE_VERSION`),不要用分支名稱:runner 依 ref 重用舊映像檔,改了腳本不會生效,所以每次改動都發新標籤。
```yaml
- uses: https://gitea.jsc.idv.tw/actions/ci-cache@${{ vars.ACTION_CI_CACHE_VERSION }}
with:
key: ...
```
## 輸入
|名稱|必填|預設|說明|
|---|---|---|---|
|`key`|是||快取 key,例如 ci-home-${{ hashFiles('go.sum', 'web/package-lock.json') }}|
|`restore_keys`|||找不到完全相同的 key 時,依序嘗試的前綴(每行一個),例如 ci-home-|
|`path`||`.ci-home`|要快取的路徑|
## 開發與發版
- CI(`ci.yaml`):用 [action-ci](https://gitea.jsc.idv.tw/actions/action-ci),並用 `uses: ./` 實際執行一次。
- CD(`cd.yaml`):「任何分支 → `main`」的 PR 合併時,用 [action-cd](https://gitea.jsc.idv.tw/actions/action-cd) 算下一個版本([next-version](https://gitea.jsc.idv.tw/actions/next-version),只遞增 patch、每位最大 9)並在 PR 來源最新提交上打標籤;只動文件、圖示、測試、`.gitea/`、`go.mod` 時不發版。直接推送 `main` 不發版。
- 呼叫端要把 Gitea 變數 `ACTION_CI_CACHE_VERSION` 改成新標籤才會採用。
- 圖示:`icon.svg`(儲存庫頭像用 `icon.png`)。