Files
prune-go/README.md
T
2026-11-05 03:17:11 +00:00

31 lines
1.2 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.
# prune-packages
部署後的善後:正式版留最新 N 個、dev 版只留基底比最新正式版新的,剛部署的版本一定保留。任何失敗只印警告並以 0 結束。
## 用法
版本由呼叫端的 Gitea Actions 變數決定(例如 `vars.ACTION_PRUNE_PACKAGES_VERSION`),不要用分支名稱:runner 依 ref 重用舊映像檔,改了腳本不會生效,所以每次改動都發新標籤。
```yaml
- uses: https://gitea.jsc.idv.tw/actions/prune-packages@${{ vars.ACTION_PRUNE_PACKAGES_VERSION }}
with:
version: ...
token: ...
```
## 輸入
|名稱|必填|預設|說明|
|---|---|---|---|
|`version`|是||剛部署的版本(一定保留)|
|`token`|是||權杖(需要 read:package 與 write:package;沒有刪除權限只會警告)|
|`gitea_url`||`${{ github.server_url }}`|Gitea 網址,預設是目前的 Gitea|
|`gitea_repo`||`${{ github.repository }}`|Gitea 儲存庫 <擁有者>/<名稱>,預設是目前的儲存庫|
|`keep_releases`|||正式版保留幾個(空=腳本預設 5)|
## 開發
`ci.yaml` 用共用的 [action-ci](https://gitea.jsc.idv.tw/actions/action-ci) 跑 shellcheck、Go 黑箱測試、映像檔建置。
圖示:`icon.svg`(Gitea 儲存庫頭像用 `icon.png`)。