@asagiri-design/labels-config 0.2.2 → 0.3.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.
- package/README.md +62 -0
- package/dist/chunk-MM4GCVPE.mjs +549 -0
- package/dist/cli.js +522 -98
- package/dist/cli.mjs +256 -103
- package/dist/github/index.d.mts +49 -1
- package/dist/github/index.d.ts +49 -1
- package/dist/github/index.js +212 -0
- package/dist/github/index.mjs +3 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/docs/BATCH_SYNC.md +396 -0
- package/docs/NPM_SETUP.md +200 -0
- package/docs/QUICK_START.md +457 -0
- package/docs/RELEASE_FLOW.md +436 -0
- package/package.json +2 -6
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
# npm Publish 更新フローガイド
|
|
2
|
+
|
|
3
|
+
このドキュメントでは、`@boxpistols/labels-config` パッケージの npm への公開フローを説明します。
|
|
4
|
+
|
|
5
|
+
## 📦 3つのリリース方法
|
|
6
|
+
|
|
7
|
+
OIDC 対応後、以下の3つのリリース方法があります:
|
|
8
|
+
|
|
9
|
+
| フロー | トリガー | バージョン | 用途 | 自動/手動 |
|
|
10
|
+
|--------|---------|-----------|------|----------|
|
|
11
|
+
| **auto-release** | main へマージ | patch のみ | 日常の開発 | ✅ 自動 |
|
|
12
|
+
| **manual-release** | Actions UI | 選択可能 | 重要なリリース | 🎯 手動 |
|
|
13
|
+
| **publish** | GitHub Release | 手動設定 | 特別なリリース | 🏷️ 手動 |
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 🔄 方法1: 自動リリース(推奨・メインフロー)
|
|
18
|
+
|
|
19
|
+
### トリガー条件
|
|
20
|
+
|
|
21
|
+
- **ブランチ**: `main`
|
|
22
|
+
- **変更パス**: `src/**` または `package.json`
|
|
23
|
+
- **除外**: コミットメッセージに `[skip ci]` または `[no release]` が含まれる場合
|
|
24
|
+
|
|
25
|
+
### フロー
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
PR作成 → レビュー → main にマージ
|
|
29
|
+
↓
|
|
30
|
+
auto-release.yml 起動
|
|
31
|
+
↓
|
|
32
|
+
パッチバージョン自動更新 (例: 0.2.0 → 0.2.1)
|
|
33
|
+
↓
|
|
34
|
+
npm run build
|
|
35
|
+
↓
|
|
36
|
+
npm publish --provenance --access public
|
|
37
|
+
↓
|
|
38
|
+
git push --follow-tags
|
|
39
|
+
↓
|
|
40
|
+
✅ 公開完了
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 実際の操作
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# 1. feature ブランチで作業
|
|
47
|
+
git checkout -b feature/awesome-feature
|
|
48
|
+
# コード変更
|
|
49
|
+
git add .
|
|
50
|
+
git commit -m "feat: add awesome feature"
|
|
51
|
+
git push origin feature/awesome-feature
|
|
52
|
+
|
|
53
|
+
# 2. PR を作成してレビュー
|
|
54
|
+
gh pr create --title "Add awesome feature" --body "..."
|
|
55
|
+
|
|
56
|
+
# 3. main にマージ(GitHub UI または CLI)
|
|
57
|
+
gh pr merge --squash
|
|
58
|
+
|
|
59
|
+
# 4. 自動的に実行される(何もする必要なし!)
|
|
60
|
+
# ✅ 約2-3分後に npm に公開される
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### リリースをスキップする場合
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# ドキュメント更新のみの場合
|
|
67
|
+
git commit -m "docs: update README [skip ci]"
|
|
68
|
+
|
|
69
|
+
# 依存関係更新のみの場合
|
|
70
|
+
git commit -m "chore: update dependencies [no release]"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 確認方法
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# GitHub Actions の実行状況を確認
|
|
77
|
+
gh run list --workflow=auto-release.yml
|
|
78
|
+
|
|
79
|
+
# 最新の npm バージョンを確認
|
|
80
|
+
npm view @boxpistols/labels-config version
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 🎯 方法2: 手動リリース(バージョン指定)
|
|
86
|
+
|
|
87
|
+
### 用途
|
|
88
|
+
|
|
89
|
+
- **minor**: 新機能を追加したとき(0.2.0 → 0.3.0)
|
|
90
|
+
- **major**: 破壊的変更があるとき(0.3.0 → 1.0.0)
|
|
91
|
+
- **prerelease**: ベータ版をリリースしたいとき(0.2.0 → 0.2.1-beta.0)
|
|
92
|
+
- **patch**: 自動リリースを使わず手動で管理したいとき(0.2.0 → 0.2.1)
|
|
93
|
+
|
|
94
|
+
### フロー
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
GitHub Actions タブ
|
|
98
|
+
↓
|
|
99
|
+
Manual Release を選択
|
|
100
|
+
↓
|
|
101
|
+
Run workflow をクリック
|
|
102
|
+
↓
|
|
103
|
+
バージョンタイプを選択 (patch/minor/major/prerelease)
|
|
104
|
+
↓
|
|
105
|
+
実行
|
|
106
|
+
↓
|
|
107
|
+
バージョン更新 → ビルド → npm publish → GitHub Release 作成
|
|
108
|
+
↓
|
|
109
|
+
✅ 完了
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 実際の操作(GitHub UI)
|
|
113
|
+
|
|
114
|
+
1. リポジトリの **Actions** タブを開く
|
|
115
|
+
2. 左サイドバーから **"Manual Release"** を選択
|
|
116
|
+
3. **"Run workflow"** ボタンをクリック
|
|
117
|
+
4. バージョンタイプを選択:
|
|
118
|
+
- `patch`: バグ修正(0.2.0 → 0.2.1)
|
|
119
|
+
- `minor`: 新機能(0.2.0 → 0.3.0)
|
|
120
|
+
- `major`: 破壊的変更(0.2.0 → 1.0.0)
|
|
121
|
+
- `prerelease`: ベータ版(0.2.0 → 0.2.1-beta.0)
|
|
122
|
+
5. **"Run workflow"** をクリック
|
|
123
|
+
|
|
124
|
+
### 実際の操作(gh CLI)
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# minor バージョンをリリース
|
|
128
|
+
gh workflow run manual-release.yml -f version_type=minor
|
|
129
|
+
|
|
130
|
+
# major バージョンをリリース
|
|
131
|
+
gh workflow run manual-release.yml -f version_type=major
|
|
132
|
+
|
|
133
|
+
# prerelease (beta) をリリース
|
|
134
|
+
gh workflow run manual-release.yml -f version_type=prerelease
|
|
135
|
+
|
|
136
|
+
# 実行状況を確認
|
|
137
|
+
gh run watch
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### ベータ版の利用方法
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# ベータ版をインストール
|
|
144
|
+
npm install @boxpistols/labels-config@beta
|
|
145
|
+
|
|
146
|
+
# 特定のベータバージョンをインストール
|
|
147
|
+
npm install @boxpistols/labels-config@0.2.1-beta.0
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 🏷️ 方法3: GitHub Release トリガー
|
|
153
|
+
|
|
154
|
+
### 用途
|
|
155
|
+
|
|
156
|
+
- 重要なマイルストーンリリース
|
|
157
|
+
- リリースノートを詳細に記述したい場合
|
|
158
|
+
- 特別なバージョン(例: v1.0.0)
|
|
159
|
+
|
|
160
|
+
### フロー
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
GitHub Release 作成
|
|
164
|
+
↓
|
|
165
|
+
publish.yml 起動
|
|
166
|
+
↓
|
|
167
|
+
npm run build
|
|
168
|
+
↓
|
|
169
|
+
npm publish --provenance --access public
|
|
170
|
+
↓
|
|
171
|
+
npm run build:umd (CDN用)
|
|
172
|
+
↓
|
|
173
|
+
✅ 完了
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### 実際の操作(GitHub UI)
|
|
177
|
+
|
|
178
|
+
1. リポジトリページ → **Releases**
|
|
179
|
+
2. **"Create a new release"** をクリック
|
|
180
|
+
3. タグを作成(例: `v0.3.0`)
|
|
181
|
+
4. リリースタイトルと詳細を入力
|
|
182
|
+
5. **"Publish release"** をクリック
|
|
183
|
+
|
|
184
|
+
### 実際の操作(gh CLI)
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# シンプルなリリース
|
|
188
|
+
gh release create v0.3.0 \
|
|
189
|
+
--title "Release v0.3.0" \
|
|
190
|
+
--notes "新機能追加"
|
|
191
|
+
|
|
192
|
+
# 自動生成されたリリースノートを使用
|
|
193
|
+
gh release create v0.3.0 \
|
|
194
|
+
--title "Release v0.3.0" \
|
|
195
|
+
--generate-notes
|
|
196
|
+
|
|
197
|
+
# ドラフトリリース(後で公開)
|
|
198
|
+
gh release create v0.3.0 \
|
|
199
|
+
--draft \
|
|
200
|
+
--title "Release v0.3.0" \
|
|
201
|
+
--notes "..."
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## 🔐 OIDC 認証フロー(内部動作)
|
|
207
|
+
|
|
208
|
+
すべてのフローで共通して以下の認証が自動的に行われます:
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
GitHub Actions 実行
|
|
212
|
+
↓
|
|
213
|
+
permissions: id-token: write が設定されている
|
|
214
|
+
↓
|
|
215
|
+
GitHub が一時的な OIDC トークンを発行
|
|
216
|
+
↓
|
|
217
|
+
npm が GitHub の署名を検証
|
|
218
|
+
↓
|
|
219
|
+
Trusted Publisher 設定を確認
|
|
220
|
+
↓
|
|
221
|
+
認証成功
|
|
222
|
+
↓
|
|
223
|
+
npm publish 実行
|
|
224
|
+
↓
|
|
225
|
+
provenance (出所証明) が自動生成
|
|
226
|
+
↓
|
|
227
|
+
✅ パッケージ公開完了
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### 従来方式との比較
|
|
231
|
+
|
|
232
|
+
| 項目 | 従来(NPM_TOKEN) | 新方式(OIDC) |
|
|
233
|
+
|------|------------------|---------------|
|
|
234
|
+
| トークン保存 | GitHub Secrets に保存 | 不要 |
|
|
235
|
+
| 有効期限 | 最大90日 | ジョブ実行時のみ(数分) |
|
|
236
|
+
| ローテーション | 手動で90日ごと | 自動(毎回新規発行) |
|
|
237
|
+
| 漏洩リスク | トークンが盗まれると悪用可能 | リスクほぼゼロ |
|
|
238
|
+
| Provenance | 手動設定が必要 | 自動生成 |
|
|
239
|
+
| 管理コスト | 高い | ほぼゼロ |
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## 💡 推奨される運用フロー
|
|
244
|
+
|
|
245
|
+
### 日常の開発フロー
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
# ✅ 推奨:自動リリースを活用
|
|
249
|
+
git checkout -b feature/new-feature
|
|
250
|
+
# コード変更
|
|
251
|
+
git commit -m "feat: add new feature"
|
|
252
|
+
git push
|
|
253
|
+
# PR 作成・マージ → 自動的にパッチバージョンがリリース
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### 新機能リリース(minor バージョンアップ)
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
# 1. main にマージ(自動でパッチバージョンがリリース)
|
|
260
|
+
# 2. その後、手動で minor バージョンをリリース
|
|
261
|
+
gh workflow run manual-release.yml -f version_type=minor
|
|
262
|
+
# → 0.2.5 → 0.3.0
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### 破壊的変更(major バージョンアップ)
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
# 1. main にマージ
|
|
269
|
+
# 2. major バージョンをリリース
|
|
270
|
+
gh workflow run manual-release.yml -f version_type=major
|
|
271
|
+
# → 0.3.0 → 1.0.0
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### ベータ版でのテスト
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
# 1. prerelease でベータ版をリリース
|
|
278
|
+
gh workflow run manual-release.yml -f version_type=prerelease
|
|
279
|
+
# → 0.3.0 → 0.3.1-beta.0
|
|
280
|
+
|
|
281
|
+
# 2. ベータ版でテスト
|
|
282
|
+
npm install @boxpistols/labels-config@beta
|
|
283
|
+
|
|
284
|
+
# 3. 問題なければ正式リリース
|
|
285
|
+
gh workflow run manual-release.yml -f version_type=minor
|
|
286
|
+
# → 0.3.1-beta.0 → 0.4.0
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## 🔍 トラブルシューティング
|
|
292
|
+
|
|
293
|
+
### エラー: "403 Forbidden" または "OIDC authentication failed"
|
|
294
|
+
|
|
295
|
+
**原因**: npm で Trusted Publisher が正しく設定されていない
|
|
296
|
+
|
|
297
|
+
**解決方法**:
|
|
298
|
+
1. [npmjs.com](https://www.npmjs.com/) で Trusted Publisher 設定を確認
|
|
299
|
+
2. Organization、Repository、Workflow、Job 名が正確に一致しているか確認
|
|
300
|
+
3. 設定の詳細は [NPM_SETUP.md](./NPM_SETUP.md) を参照
|
|
301
|
+
|
|
302
|
+
### エラー: "Provenance generation failed"
|
|
303
|
+
|
|
304
|
+
**原因**: ワークフローの `permissions` 設定が不足している
|
|
305
|
+
|
|
306
|
+
**解決方法**:
|
|
307
|
+
- ワークフローファイルに以下が含まれているか確認:
|
|
308
|
+
```yaml
|
|
309
|
+
permissions:
|
|
310
|
+
contents: write # または read
|
|
311
|
+
id-token: write # OIDC に必須
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### 自動リリースがスキップされる
|
|
315
|
+
|
|
316
|
+
**原因**: コミットメッセージに除外キーワードが含まれている
|
|
317
|
+
|
|
318
|
+
**確認方法**:
|
|
319
|
+
```bash
|
|
320
|
+
git log -1 --pretty=%B
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
**解決方法**:
|
|
324
|
+
- `[skip ci]` または `[no release]` を含まないコミットメッセージを使用
|
|
325
|
+
|
|
326
|
+
### バージョンが更新されない
|
|
327
|
+
|
|
328
|
+
**原因**: ワークフローが実行されていない、または失敗している
|
|
329
|
+
|
|
330
|
+
**確認方法**:
|
|
331
|
+
```bash
|
|
332
|
+
# ワークフローの実行履歴を確認
|
|
333
|
+
gh run list --workflow=auto-release.yml --limit 5
|
|
334
|
+
|
|
335
|
+
# 失敗したワークフローのログを確認
|
|
336
|
+
gh run view <run-id> --log-failed
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### npm に公開されたか確認
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
# 最新バージョンを確認
|
|
343
|
+
npm view @boxpistols/labels-config version
|
|
344
|
+
|
|
345
|
+
# パッケージ情報を確認
|
|
346
|
+
npm view @boxpistols/labels-config
|
|
347
|
+
|
|
348
|
+
# provenance を確認
|
|
349
|
+
npm view @boxpistols/labels-config --json | jq '.dist.integrity'
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## 📊 バージョニング戦略
|
|
355
|
+
|
|
356
|
+
### Semantic Versioning (SemVer)
|
|
357
|
+
|
|
358
|
+
このパッケージは [SemVer](https://semver.org/) に従っています:
|
|
359
|
+
|
|
360
|
+
- **MAJOR** (1.0.0): 破壊的変更(API の変更など)
|
|
361
|
+
- **MINOR** (0.1.0): 後方互換性のある新機能
|
|
362
|
+
- **PATCH** (0.0.1): 後方互換性のあるバグ修正
|
|
363
|
+
|
|
364
|
+
### 推奨されるバージョンアップ基準
|
|
365
|
+
|
|
366
|
+
| 変更内容 | バージョンタイプ | 例 |
|
|
367
|
+
|----------|----------------|-----|
|
|
368
|
+
| バグ修正 | patch | 0.2.0 → 0.2.1 |
|
|
369
|
+
| 新しいテンプレート追加 | minor | 0.2.0 → 0.3.0 |
|
|
370
|
+
| 新しい CLI コマンド追加 | minor | 0.2.0 → 0.3.0 |
|
|
371
|
+
| API の破壊的変更 | major | 0.2.0 → 1.0.0 |
|
|
372
|
+
| 設定ファイルフォーマット変更 | major | 0.2.0 → 1.0.0 |
|
|
373
|
+
| ドキュメント更新のみ | なし([skip ci]) | - |
|
|
374
|
+
| 依存関係更新のみ | patch または [skip ci] | 0.2.0 → 0.2.1 |
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
## 🎯 クイックリファレンス
|
|
379
|
+
|
|
380
|
+
### 通常の開発
|
|
381
|
+
|
|
382
|
+
```bash
|
|
383
|
+
# PR をマージするだけ
|
|
384
|
+
gh pr merge --squash
|
|
385
|
+
# → 自動でパッチバージョンがリリース
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### 新機能リリース
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
# GitHub Actions UI から Manual Release (minor) を実行
|
|
392
|
+
# または
|
|
393
|
+
gh workflow run manual-release.yml -f version_type=minor
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### 破壊的変更リリース
|
|
397
|
+
|
|
398
|
+
```bash
|
|
399
|
+
# GitHub Actions UI から Manual Release (major) を実行
|
|
400
|
+
# または
|
|
401
|
+
gh workflow run manual-release.yml -f version_type=major
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### ベータ版リリース
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
gh workflow run manual-release.yml -f version_type=prerelease
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
### リリースをスキップ
|
|
411
|
+
|
|
412
|
+
```bash
|
|
413
|
+
git commit -m "docs: update [skip ci]"
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### リリース状況の確認
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
# ワークフロー実行状況
|
|
420
|
+
gh run list --workflow=auto-release.yml --limit 5
|
|
421
|
+
|
|
422
|
+
# npm での最新バージョン
|
|
423
|
+
npm view @boxpistols/labels-config version
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
---
|
|
427
|
+
|
|
428
|
+
## 📚 関連ドキュメント
|
|
429
|
+
|
|
430
|
+
- [npm Trusted Publishers (OIDC) セットアップガイド](./NPM_SETUP.md)
|
|
431
|
+
- [GitHub Actions ワークフロー](./.github/workflows/)
|
|
432
|
+
- [npm package provenance](https://docs.npmjs.com/generating-provenance-statements)
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
**すべてのリリースは自動化されています。トークン管理は不要です 🎉**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asagiri-design/labels-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Terminal-first label management system for GitHub repositories using gh CLI - No token required",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -43,11 +43,7 @@
|
|
|
43
43
|
"lint": "eslint src --fix",
|
|
44
44
|
"cli": "tsx src/cli.ts",
|
|
45
45
|
"prepublishOnly": "npm run build",
|
|
46
|
-
"version": "node -e \"const fs=require('fs');const v=require('./package.json').version;fs.writeFileSync('src/version.ts','export const version = \\''+v+'\\'\\n')\" && git add src/version.ts"
|
|
47
|
-
"release:patch": "npm version patch -m 'Release v%s [skip ci]' && npm publish --access public && git push --follow-tags",
|
|
48
|
-
"release:minor": "npm version minor -m 'Release v%s [skip ci]' && npm publish --access public && git push --follow-tags",
|
|
49
|
-
"release:major": "npm version major -m 'Release v%s [skip ci]' && npm publish --access public && git push --follow-tags",
|
|
50
|
-
"release:beta": "npm version prerelease --preid=beta -m 'Release v%s [skip ci]' && npm publish --access public --tag beta && git push --follow-tags"
|
|
46
|
+
"version": "node -e \"const fs=require('fs');const v=require('./package.json').version;fs.writeFileSync('src/version.ts','export const version = \\''+v+'\\'\\n')\" && git add src/version.ts"
|
|
51
47
|
},
|
|
52
48
|
"keywords": [
|
|
53
49
|
"labels",
|