-
Notifications
You must be signed in to change notification settings - Fork 0
setup: npm publish (changesets + release workflow) #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
amotarao
wants to merge
6
commits into
main
Choose a base branch
from
setup/npm-publish
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2a103c2
chore: install @changesets/cli and @changesets/config
amotarao b1d961a
chore: add version and release scripts
amotarao 96c6c97
chore: setup changesets config
amotarao e74ee8f
ci: add release workflow
amotarao 3fb3386
docs: add release guide to README
amotarao 3542c1c
chore: format
amotarao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Changesets | ||
|
|
||
| Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works | ||
| with multi-package repos, or single-package repos to help you version and publish your code. You can | ||
| find the full documentation for it [in our repository](https://github.com/changesets/changesets) | ||
|
|
||
| We have a quick list of common questions to get you started engaging with this project in | ||
| [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "$schema": "../node_modules/@changesets/config/schema.json", | ||
| "changelog": "@changesets/cli/changelog", | ||
| "commit": false, | ||
| "fixed": [], | ||
| "linked": [], | ||
| "access": "public", | ||
| "baseBranch": "main", | ||
| "updateInternalDependencies": "patch", | ||
| "ignore": [] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Release | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: pnpm/action-setup@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 24 | ||
| cache: pnpm | ||
| registry-url: https://registry.npmjs.org | ||
| - run: pnpm install --frozen-lockfile | ||
| - uses: changesets/action@v1 | ||
| with: | ||
| publish: pnpm run release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,45 @@ | ||
| # next-utils | ||
|
|
||
| ## リリース手順 | ||
|
|
||
| このリポジトリは [changesets](https://github.com/changesets/changesets) を使ってバージョン管理と npm publish を行います。 | ||
|
|
||
| ### 1. changeset を作成する | ||
|
|
||
| パッケージに変更を加えたら、その変更内容を記録するファイルを作成します。 | ||
|
|
||
| ```bash | ||
| pnpm changeset | ||
| ``` | ||
|
|
||
| 対話形式で以下を入力します: | ||
|
|
||
| - **対象パッケージ** — 変更したパッケージを選択 | ||
| - **バージョンの種類** — `patch` / `minor` / `major` を選択 | ||
| - **変更内容の説明** — changelog に記載されるメッセージを入力 | ||
|
|
||
| 実行後、`.changeset/` に `.md` ファイルが生成されます。このファイルを変更と一緒にコミットして PR を出してください。 | ||
|
|
||
| ### 2. main にマージする | ||
|
|
||
| PR を main にマージすると、GitHub Actions が自動的に動きます。 | ||
|
|
||
| - **changeset ファイルがある場合** — "Version Packages" という PR が自動作成されます | ||
| - **changeset ファイルがない場合** — 何も起きません | ||
|
|
||
| ### 3. "Version Packages" PR をマージする | ||
|
|
||
| 自動作成された "Version Packages" PR には以下が含まれます: | ||
|
|
||
| - 各パッケージの `package.json` のバージョン更新 | ||
| - `CHANGELOG.md` の更新 | ||
|
|
||
| この PR をマージすると、GitHub Actions が npm に自動で publish します。 | ||
|
|
||
| ### 事前準備(初回のみ) | ||
|
|
||
| リポジトリの Settings → Secrets に以下を追加してください: | ||
|
|
||
| | Secret 名 | 値 | | ||
| | ----------- | ---------------------------------------------- | | ||
| | `NPM_TOKEN` | npm の Access Token(`Automation` タイプ推奨) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: plainbrew/next-utils
Length of output: 118
🏁 Script executed:
Repository: plainbrew/next-utils
Length of output: 799
🏁 Script executed:
Repository: plainbrew/next-utils
Length of output: 118
🏁 Script executed:
Repository: plainbrew/next-utils
Length of output: 117
id-token: writeは使用されていないため削除してくださいこのワークフローは npm レジストリへの認証に
NODE_AUTH_TOKEN環境変数を使用しており、OIDC トークンは利用されていません。provenance 署名やその他の OIDC ベースの操作も存在しないため、この権限は不要です。最小権限の原則に従い削除してください。修正例
permissions: contents: write pull-requests: write - id-token: write📝 Committable suggestion
🤖 Prompt for AI Agents