Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0109c9983 | ||
|
|
69d8509b3c | ||
|
|
75299f4c1b | ||
|
|
881a827f46 | ||
|
|
3f8ed6aeba | ||
|
|
7a49ff1d81 | ||
|
|
fd676706ad | ||
|
|
39517dd66b | ||
|
|
2a896af19e | ||
|
|
d8d6152482 |
@@ -0,0 +1,22 @@
|
|||||||
|
name: cd
|
||||||
|
# 只在「任何分支 → main」的 PR 合併時發版:action-cd 用 next-version 算下一版,沒有跳過就在 PR 來源分支的最新提交(pull_request.head.sha)上打標籤並推送。
|
||||||
|
# branches 寫死 main,來源分支不限;PR 沒合併就關閉時,tag 工作在工作層級跳過。直接推送 main 不發版。
|
||||||
|
# 版本只遞增 patch、每位最大 9,沒有標籤時從 v0.0.1 開始。只動文件、圖示、測試、.gitea/、go.mod 時不發版(這些不會進映像檔,也不影響使用者)。
|
||||||
|
# 呼叫端用標籤引用這個 action(版本取自 Gitea 變數),所以發版後要到呼叫端把 ACTION_<名稱>_VERSION 改成新標籤才會生效。
|
||||||
|
# 沒有手動觸發:發版失敗時重跑這個 workflow 的 run。
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [closed]
|
||||||
|
branches: [main]
|
||||||
|
# 排隊、不取消:連續推送依序發版,版本不重複
|
||||||
|
concurrency:
|
||||||
|
group: cd
|
||||||
|
cancel-in-progress: false
|
||||||
|
jobs:
|
||||||
|
tag:
|
||||||
|
if: ${{ github.event.pull_request.merged == true }}
|
||||||
|
runs-on: docker-ubuntu
|
||||||
|
steps:
|
||||||
|
- uses: https://gitea.jsc.idv.tw/actions/action-cd@${{ vars.ACTION_ACTION_CD_VERSION }}
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.TOKEN || github.token }}
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
name: ci
|
name: ci
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
pull_request:
|
pull_request:
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ci-${{ github.ref }}
|
group: ci-${{ github.ref }}
|
||||||
@@ -10,8 +8,9 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
runs-on: docker-ubuntu
|
runs-on: docker-ubuntu
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: https://gitea.jsc.idv.tw/actions/action-ci@${{ vars.ACTION_ACTION_CI_VERSION }}
|
||||||
- uses: ./
|
- name: 自測
|
||||||
|
uses: ./
|
||||||
with:
|
with:
|
||||||
key: ci-cache-selftest-${{ github.sha }}
|
key: ci-cache-selftest-${{ github.sha }}
|
||||||
restore_keys: ci-cache-selftest-
|
restore_keys: ci-cache-selftest-
|
||||||
|
|||||||
@@ -20,8 +20,13 @@
|
|||||||
|`restore_keys`|||找不到完全相同的 key 時,依序嘗試的前綴(每行一個),例如 ci-home-|
|
|`restore_keys`|||找不到完全相同的 key 時,依序嘗試的前綴(每行一個),例如 ci-home-|
|
||||||
|`path`||`.ci-home`|要快取的路徑|
|
|`path`||`.ci-home`|要快取的路徑|
|
||||||
|
|
||||||
## 開發
|
## 內部引用的版本
|
||||||
|
|
||||||
`ci.yaml` 跑 ,並用 `uses: ./` 實際執行一次。
|
`actions/cache` 的版本取自呼叫端 repo 的 Gitea 變數 `ACTION_CACHE_VERSION`(例如 `v4`),不寫死在 `action.yml`,所以呼叫端要先設好。
|
||||||
|
|
||||||
圖示:`icon.svg`(Gitea 儲存庫頭像用 `icon.png`)。
|
## 開發與發版
|
||||||
|
|
||||||
|
- 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`)。
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
name: ci-cache
|
name: ci-cache
|
||||||
description: "還原與儲存 CI 的快取目錄(預設 workspace 的 .ci-home:Go 模組與建置快取、npm、工具鏈、rod 下載的 Chromium)。包一層 actions/cache,要在 checkout 之後使用;key 由呼叫端用 hashFiles 算好傳入"
|
description: "還原與儲存 CI 的快取目錄(預設 workspace 的 .ci-home:Go 模組與建置快取、npm、工具鏈、rod 下載的 Chromium)。包一層 actions/cache(版本取自呼叫端的 Gitea 變數 ACTION_CACHE_VERSION),要在 checkout 之後使用;key 由呼叫端用 hashFiles 算好傳入"
|
||||||
inputs:
|
inputs:
|
||||||
key:
|
key:
|
||||||
description: "快取 key,例如 ci-home-${{ hashFiles('go.sum', 'web/package-lock.json') }}"
|
description: "快取 key,例如 ci-home-${{ hashFiles('go.sum', 'web/package-lock.json') }}"
|
||||||
@@ -13,7 +13,7 @@ inputs:
|
|||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@${{ vars.ACTION_CACHE_VERSION }}
|
||||||
with:
|
with:
|
||||||
path: ${{ inputs.path }}
|
path: ${{ inputs.path }}
|
||||||
key: ${{ inputs.key }}
|
key: ${{ inputs.key }}
|
||||||
|
|||||||
Reference in New Issue
Block a user