From 094ce0ef6166efdb60fec1d4fb5672ef9e9d5f62 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Dec 2025 17:43:57 +0000 Subject: [PATCH 1/5] Initial plan From 5a3434229cdc3e9d5df8a1ab2d3b9a8c90b162f0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Dec 2025 17:47:01 +0000 Subject: [PATCH 2/5] Add GitHub Packages publishing support to release workflow Co-authored-by: yuki-js <20838151+yuki-js@users.noreply.github.com> --- .github/workflows/release.yml | 22 +++++++++++++++++++--- .npmrc | 2 ++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 .npmrc diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b3b8d15..0ec41a2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,18 +17,34 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Node.js + - name: Set up Node.js for npm uses: actions/setup-node@v4 with: node-version: "22" + registry-url: "https://registry.npmjs.org" - name: Install dependencies run: npm ci - - name: Create Release Pull Request or Publish + - name: Create Release Pull Request or Publish to npm + id: changesets uses: changesets/action@v1 with: publish: npm run release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Set up Node.js for GitHub Packages + if: steps.changesets.outputs.published == 'true' + uses: actions/setup-node@v4 + with: + node-version: "22" + registry-url: "https://npm.pkg.github.com" + scope: "@aokiapp" + + - name: Publish to GitHub Packages + if: steps.changesets.outputs.published == 'true' + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..c4fe4b9 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +@aokiapp:registry=https://npm.pkg.github.com +//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN} From 4616cac725d9b97dc7bb9f95a53be50452437959 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Dec 2025 17:48:22 +0000 Subject: [PATCH 3/5] Update documentation for GitHub Packages installation Co-authored-by: yuki-js <20838151+yuki-js@users.noreply.github.com> --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 58447bb..0d7f30a 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,24 @@ Tag-Length-Value (TLV) parser and builder library with schema support. Provides ## Installation +### From npm + ```bash npm install @aokiapp/tlv ``` +### From GitHub Packages + +```bash +npm install @aokiapp/tlv --registry=https://npm.pkg.github.com +``` + +Or configure your `.npmrc`: + +``` +@aokiapp:registry=https://npm.pkg.github.com +``` + ## Quick Start ### Basic TLV Parsing @@ -527,12 +541,18 @@ npm run format # Prettier ### Release +This library is automatically published to both npm and GitHub Packages via GitHub Actions. + ```bash npm run changelog # Create changeset npm run version # Update version -npm run publish # Publish to npm +npm run publish # Publish to npm (manual, or use GitHub Actions) ``` +When changes are pushed to the `main` branch with a changeset, the GitHub Actions workflow will: +1. Create a release PR or publish to npm +2. Automatically publish to GitHub Packages if npm publish succeeds + ## Project Structure ``` From 44b3c44e15a834454f422ad45cd4fef1a8e27152 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Dec 2025 17:49:50 +0000 Subject: [PATCH 4/5] Address code review feedback: improve step names and add authentication note Co-authored-by: yuki-js <20838151+yuki-js@users.noreply.github.com> --- .github/workflows/release.yml | 6 +++--- README.md | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0ec41a2..31852ad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Node.js for npm + - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: "22" @@ -26,7 +26,7 @@ jobs: - name: Install dependencies run: npm ci - - name: Create Release Pull Request or Publish to npm + - name: Create Release Pull Request or Publish id: changesets uses: changesets/action@v1 with: @@ -35,7 +35,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Set up Node.js for GitHub Packages + - name: Set up Node.js for GitHub Packages publishing if: steps.changesets.outputs.published == 'true' uses: actions/setup-node@v4 with: diff --git a/README.md b/README.md index 0d7f30a..daa98a2 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,16 @@ npm install @aokiapp/tlv ### From GitHub Packages +**Note**: GitHub Packages requires authentication even for public packages. + +First, authenticate with GitHub: + +```bash +npm login --registry=https://npm.pkg.github.com +``` + +Then install: + ```bash npm install @aokiapp/tlv --registry=https://npm.pkg.github.com ``` @@ -29,6 +39,7 @@ Or configure your `.npmrc`: ``` @aokiapp:registry=https://npm.pkg.github.com +//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN ``` ## Quick Start From bd8307fbbe59d474b5e5b8c906b888c1b3a23bd0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Dec 2025 18:12:30 +0000 Subject: [PATCH 5/5] Fix review issues: remove .npmrc, add rebuild, fix README, format with prettier Co-authored-by: yuki-js <20838151+yuki-js@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- .npmrc | 2 -- README.md | 3 ++- vitest.config.js | 7 +------ 4 files changed, 4 insertions(+), 10 deletions(-) delete mode 100644 .npmrc diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 31852ad..dad74b3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,6 +45,6 @@ jobs: - name: Publish to GitHub Packages if: steps.changesets.outputs.published == 'true' - run: npm publish + run: npm run build && npm publish env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.npmrc b/.npmrc deleted file mode 100644 index c4fe4b9..0000000 --- a/.npmrc +++ /dev/null @@ -1,2 +0,0 @@ -@aokiapp:registry=https://npm.pkg.github.com -//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN} diff --git a/README.md b/README.md index daa98a2..5b8eec7 100644 --- a/README.md +++ b/README.md @@ -557,10 +557,11 @@ This library is automatically published to both npm and GitHub Packages via GitH ```bash npm run changelog # Create changeset npm run version # Update version -npm run publish # Publish to npm (manual, or use GitHub Actions) +npm run publish # Publish manually (for testing, otherwise use GitHub Actions) ``` When changes are pushed to the `main` branch with a changeset, the GitHub Actions workflow will: + 1. Create a release PR or publish to npm 2. Automatically publish to GitHub Packages if npm publish succeeds diff --git a/vitest.config.js b/vitest.config.js index 038978e..edc0479 100644 --- a/vitest.config.js +++ b/vitest.config.js @@ -29,12 +29,7 @@ export default defineConfig({ provider: "istanbul", reporter: ["text", "text-summary"], include: ["src/**/*.ts"], - exclude: [ - "tests/**", - "examples/**", - ".changeset/**", - "**/*.d.ts", - ], + exclude: ["tests/**", "examples/**", ".changeset/**", "**/*.d.ts"], }, }, });