blueprint-shared-docs 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@
4
4
  "entry": "blueprint-shared",
5
5
  "layer": "org",
6
6
  "describes": {
7
- "blueprint-shared-docs": "0.5.0"
7
+ "blueprint-shared-docs": "0.6.0"
8
8
  },
9
9
  "publish": {
10
10
  "target": "npm",
@@ -5267,6 +5267,122 @@
5267
5267
  "appliesFrom": "0.1.0",
5268
5268
  "supersedes": []
5269
5269
  },
5270
+ {
5271
+ "type": "decision",
5272
+ "id": "publish-binary-and-image-targets",
5273
+ "title": "發布規則加執行檔發到公開發布倉與容器映像推 ghcr 兩種目標,單元用政策檔的選填欄位 `publish.to` 選目標",
5274
+ "topics": [],
5275
+ "sections": [
5276
+ {
5277
+ "id": "context",
5278
+ "title": "背景",
5279
+ "blocks": [
5280
+ {
5281
+ "kind": "text",
5282
+ "text": "原本的發布規則只有 npm、PyPI、crates.io、GitHub Packages 與 Go、Swift 的公開鏡像倉。Go 的指令工具要讓使用者用 Homebrew 安裝,服務要把容器映像交給部署,這兩種產物都沒有共用的發布規則,各倉只能自己寫。"
5283
+ },
5284
+ {
5285
+ "kind": "text",
5286
+ "text": "另一個問題是單元怎麼選目標。原本發布腳本只看單元目錄裡的檔案,例如有 `go.mod` 就走鏡像倉。這個方式表達不了「這個單元不發布」,也分不出要發布的 Go 指令工具和只是有 `package main` 的內部程式。"
5287
+ }
5288
+ ]
5289
+ },
5290
+ {
5291
+ "id": "options",
5292
+ "title": "選項",
5293
+ "blocks": [
5294
+ {
5295
+ "kind": "list",
5296
+ "items": [
5297
+ "a. 加兩種目標,單元在政策檔用選填欄位 `publish.to` 選 `binary`、`image` 或 `none`。沒寫時照檔案判斷。",
5298
+ "b. 加兩種目標,但從檔案推斷。有 Dockerfile 就推映像,Go 的 `package main` 就發執行檔。",
5299
+ "c. 加兩種目標,並在 `kind` 加新值,例如 `cli` 與 `image`。",
5300
+ "d. 不放進共用規則,由各倉自己寫發布流程。"
5301
+ ]
5302
+ }
5303
+ ]
5304
+ },
5305
+ {
5306
+ "id": "decision",
5307
+ "title": "決定",
5308
+ "blocks": [
5309
+ {
5310
+ "kind": "text",
5311
+ "text": "採用 a。規則寫成下列 fact,以最新一列為準。"
5312
+ },
5313
+ {
5314
+ "kind": "list",
5315
+ "items": [
5316
+ "`publish.to` 有三個值。`binary` 發編譯好的執行檔,`image` 推容器映像到 ghcr,`none` 表示不發布。",
5317
+ "單元沒寫 `publish` 時,照單元的檔案判斷,和原本一樣。既有的 Go 函式庫因此照舊走鏡像倉。",
5318
+ "寫了 `publish.to` 就以它為準。Go 單元寫 `binary`、`image` 或 `none` 時,不再推鏡像倉,見 `go-swift-mirror-repos`。",
5319
+ "`binary` 只用於 `kind` 是 `package` 的單元,要帶 `command`、`description`、`platforms`。這一版只支援 Go,單元沒有 `go.mod` 時檢查報錯並寫出原因。",
5320
+ "`image` 只用於 `kind` 是 `service` 或 `backend` 的單元,要帶 `platforms`。它不經 tag 部署,所以不必寫 `targets`。",
5321
+ "執行檔依政策檔的平台交叉編譯,連同 checksum 發到組織值指定的公開發布倉。預發布只發 GitHub prerelease,GA 才更新 Homebrew formula。",
5322
+ "映像推到 `ghcr.io`,不打 latest,digest 附在來源倉單元 tag 的 Release。映像不帶組織設定,部署時才掛入。",
5323
+ "執行檔的 token 用組織的 bot App,`repositories` 只限發布倉,權限只給 `contents: write`。映像的 token 用 job 的 `GITHUB_TOKEN` 加 `packages: write`,因為 bot App 沒有 packages 權限。"
5324
+ ]
5325
+ },
5326
+ {
5327
+ "kind": "fact",
5328
+ "facts": [
5329
+ "blueprint-shared.publishing.target-selection",
5330
+ "blueprint-shared.publishing.binary-release",
5331
+ "blueprint-shared.publishing.container-image",
5332
+ "blueprint-shared.release-policy.unit-publish",
5333
+ "blueprint-shared.publishing.methods",
5334
+ "blueprint-shared.publishing.go-swift-mirror"
5335
+ ]
5336
+ }
5337
+ ]
5338
+ },
5339
+ {
5340
+ "id": "rationale",
5341
+ "title": "理由",
5342
+ "blocks": [
5343
+ {
5344
+ "kind": "list",
5345
+ "items": [
5346
+ "選 a 讓既有的倉不用改政策檔。沒寫 `publish` 的單元行為不變,新欄位只影響明確選了目標的單元。",
5347
+ "選 b 的檔案推斷表達不了「不發布」,因為檔案在就會被推到某個目標。它也分不出要發布的 Go 指令工具和只是有 `package main` 的內部程式,會把內部程式發出去。",
5348
+ "選 c 不加新的 `kind`,因為 `kind` 管的是階段與部署方式,發布去處是另一件事。同一個 `kind` 的單元可以發到不同地方,也可以不發。",
5349
+ "選 d 讓每個倉各寫一份 token 縮權、重跑冪等與 digest 記錄,容易寫錯,錯了又是不可逆的發布。",
5350
+ "映像不帶組織設定,所以同一個映像可以放在 ghcr 而不洩漏組織值,設定由部署時掛入。",
5351
+ "執行檔用組織 bot App 並把 token 縮到發布倉,因為發布倉是另一個倉,要有寫入權限,縮權後 token 洩漏也只影響發布倉。映像用 `GITHUB_TOKEN`,因為 bot App 沒有 packages 權限,而 digest 附在來源倉自己的 Release,同一個 token 的 `contents: write` 就夠,不必另外產生憑證。"
5352
+ ]
5353
+ }
5354
+ ]
5355
+ },
5356
+ {
5357
+ "id": "consequences",
5358
+ "title": "代價",
5359
+ "blocks": [
5360
+ {
5361
+ "kind": "list",
5362
+ "items": [
5363
+ "單元的發布目標有兩個來源,政策檔的 `publish.to` 與沒寫時的檔案判斷。讀者要先看政策檔,才知道單元去哪裡。",
5364
+ "`go-swift-mirror-repos` 說每個 Go 單元一個鏡像倉,現在只適用沒寫 `publish.to` 的單元。那份決策已採納,內文不改,以這份和 fact 為準。",
5365
+ "要用 `binary` 的倉要填組織值 `binaryReleaseRepository`,要用 `image` 的倉要有帶 docker 標籤的 runner,沒填時發布 job 停下並寫出原因。",
5366
+ "ghcr 套件第一次推送是私有。要公開時由人在 GitHub 改一次,改了收不回。",
5367
+ "formula 把 `url` 放在 `on_*` 區塊是 goreleaser 的寫法,Homebrew 官方文件沒有描述,要用 `brew install` 實測。"
5368
+ ]
5369
+ }
5370
+ ]
5371
+ }
5372
+ ],
5373
+ "factRefs": [
5374
+ "blueprint-shared.publishing.target-selection",
5375
+ "blueprint-shared.publishing.binary-release",
5376
+ "blueprint-shared.publishing.container-image",
5377
+ "blueprint-shared.release-policy.unit-publish",
5378
+ "blueprint-shared.publishing.methods",
5379
+ "blueprint-shared.publishing.go-swift-mirror"
5380
+ ],
5381
+ "docRefs": [],
5382
+ "status": "accepted",
5383
+ "appliesFrom": "0.6.0",
5384
+ "supersedes": []
5385
+ },
5270
5386
  {
5271
5387
  "type": "decision",
5272
5388
  "id": "publish-dispatch-per-version-stage",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blueprint-shared-docs",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Decisions and explanations shared by several products, published on its own",
5
5
  "license": "MIT",
6
6
  "author": "Carlos Space",
@@ -17,7 +17,7 @@
17
17
  "dist"
18
18
  ],
19
19
  "devDependencies": {
20
- "blueprint-shared-facts": "0.9.0",
20
+ "blueprint-shared-facts": "0.11.0",
21
21
  "clarify-kit": "^0.3.1",
22
22
  "fact-kit": "^0.14.1",
23
23
  "oxc-parser": "^0.155.0"