diff --git a/.claude/commands/release.yml b/.claude/commands/release.yml new file mode 100644 index 0000000..dc95261 --- /dev/null +++ b/.claude/commands/release.yml @@ -0,0 +1,20 @@ +new_version = get_version_without_v_prefix($ARGUMENTS) # 例: 1.0.0 +new_version_with_v_prefix = get_version_with_v_prefix($ARGUMENTS) # 例: v1.0.0 + +new_versionの指定がない場合、patchバージョンを現在のバージョンから+1した値をnew_version,new_version_with_v_prefixに設定します。 + +1. 現在 main ブランチにいることを確認します。main ブランチでない場合は、この操作を中止します。 +2. `git pull` を実行します。 +3. `git checkout -b release/{new_version_with_v_prefix}` を実行します。 +4. `src/cli/index.ts` 内のバージョンを更新します。その後、`git add` と `git commit` を実行します。 +5. `pnpm version {new_version} --no-git-tag-version` でバージョンを更新します。 +6. `package.json` が変更されるため、`git commit` と `git push` を実行します。 +7. `gh pr create` と `gh pr merge` を実行して、リリースブランチを main ブランチにマージします。 +8. 前のバージョンタグと現在のコミット間のコード変更を比較して、リリース説明を準備します。 + - 英語で記述します。 + - 機密情報は含めません。 + - `What's Changed`、`Contributors`、`Full Changelog` のセクションが必要です。 + - `./tmp/release-notes.md` をリリースノートとして使用します。 +9. 予防措置として、リリース内容に非公開にすべき情報が含まれていないことを確認します。 +10. `gh release create {new_version_with_v_prefix} --title {new_version_with_v_prefix} --notes-file ./tmp/release-notes.md ...` コマンドを使用して、`github.com/classmethod/tsumiki` リポジトリでタイトルとタグの両方を new_version_with_v_prefix に設定し、ステップ4の内容を説明として使用してリリースを作成します。 +11. main ブランチに戻ります。 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b5b8eed --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,49 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + quality: + name: Code Quality & Tests + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '24' + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 10.13.1 + + - name: Install dependencies + run: pnpm install --ignore-scripts + + - name: Check no files generated after install + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Error: Files were generated or modified after pnpm install" + git status --porcelain + exit 1 + fi + + - name: Run check + run: pnpm check + + - name: Run secretlint + run: pnpm secretlint + + - name: Run typecheck + run: pnpm typecheck + + - name: Build project + run: pnpm build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7929ba5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Release + +on: + release: + types: [created] + +jobs: + publish: + name: Publish to NPM + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: main + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '24' + registry-url: 'https://registry.npmjs.org' + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 10.13.1 + + - name: Install dependencies + run: pnpm install + + - name: Run quality checks + run: | + pnpm check + pnpm secretlint + pnpm typecheck + + - name: Publish to npm + run: pnpm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index 1248700..082fc2b 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ Thumbs.db # Dependencies node_modules/ +.pnpm-store/ package-lock.json yarn.lock pnpm-lock.yaml @@ -24,4 +25,9 @@ pnpm-lock.yaml # Build output dist/ *.tsbuildinfo -assets/ + +# Claude Code +.claude/settings.local.json + +# Others +tmp/