Files
build-go/README.md
T
bot ae4360ab00
cd / tag (pull_request) Successful in 1m12s
ci / test (pull_request) Successful in 5s
調整:ci/cd 一致化(action-ci 自動偵測、action-cd)、版本計算抽到 next-version
2026-11-05 04:12:39 +00:00

35 lines
1.7 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.
# build-go
建立版本標籤(只在本機)、執行建置前置指令,把原始碼與建置結果打包成 Gitea Go 套件庫要的模組 zip。下一步接 `publish-go` 上傳。
## 用法
版本由呼叫端的 Gitea Actions 變數決定(例如 `vars.ACTION_BUILD_GO_VERSION`),不要用分支名稱:runner 依 ref 重用舊映像檔,改了腳本不會生效,所以每次改動都發新標籤。
```yaml
- uses: https://gitea.jsc.idv.tw/actions/build-go@${{ vars.ACTION_BUILD_GO_VERSION }}
with:
version: ...
```
## 輸入
|名稱|必填|預設|說明|
|---|---|---|---|
|`version`|是||要發佈的版本(例如 v0.5.4 或 v0.5.5-dev.2)|
|`prebuild`|||打包前執行的 shell 指令,用來產生不在 git 裡的建置結果(例如 make web worker-embed)|
|`include`|||要放進模組 zip 的建置結果路徑(相對於儲存庫根目錄,檔案或目錄,空白或換行分隔),少了任何一個就失敗|
## 輸出
|名稱|說明|
|---|---|
|`zip`|模組 zip 的路徑(相對於 workspace),傳給 publish-go|
## 開發與發版
- CI(`ci.yaml`):用 [action-ci](https://gitea.jsc.idv.tw/actions/action-ci) 跑 shellcheck,建置映像檔。
- 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_BUILD_GO_VERSION` 改成新標籤才會採用。
- 圖示:`icon.svg`(儲存庫頭像用 `icon.png`)。