Skip to content

Commit b55a672

Browse files
committed
fix: resolve GitHub Packages publishing permission error
- Remove scoped package name (@mearman/mcp-template) from package.json - Remove publishConfig pointing to GitHub Packages registry - Update semantic-release to disable npm publishing (npmPublish: false) - Remove GitHub Packages registry from semantic-release workflow - Add separate GitHub Packages publishing step after semantic-release - Remove NPM publishing from release workflow (template only publishes to GitHub Packages) The issue was that semantic-release was trying to publish a scoped package directly to GitHub Packages, which requires different permissions. Following the pattern from mcp-wayback-machine, we now: 1. Keep an unscoped name in package.json 2. Let semantic-release handle versioning without publishing to npm 3. Publish to GitHub Packages in a separate step with the scoped name
1 parent b6da6cb commit b55a672

File tree

4 files changed

+24
-16
lines changed

4 files changed

+24
-16
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,6 @@ jobs:
102102
sbom.spdx.json
103103
generate_release_notes: true
104104

105-
- name: Publish to NPM
106-
if: ${{ secrets.NPM_TOKEN != '' }}
107-
run: npm publish --access public --provenance
108-
env:
109-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
110-
111105
- name: Setup Node.js for GitHub Packages
112106
uses: actions/setup-node@v4
113107
with:

.github/workflows/semantic-release.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ jobs:
2828
uses: actions/setup-node@v4
2929
with:
3030
node-version: '20'
31-
registry-url: 'https://npm.pkg.github.com'
32-
scope: '@mearman'
31+
registry-url: 'https://registry.npmjs.org'
3332

3433
- name: Enable Corepack
3534
run: corepack enable
@@ -47,8 +46,8 @@ jobs:
4746
id: semantic-release
4847
env:
4948
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50-
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
NPM_TOKEN: ''
50+
NODE_AUTH_TOKEN: ''
5251
run: |
5352
# Capture the current version before release
5453
CURRENT_VERSION=$(node -p "require('./package.json').version")
@@ -87,3 +86,22 @@ jobs:
8786
subject-path: './dist'
8887
sbom-path: './sbom.spdx.json'
8988

89+
- name: Setup Node.js for GitHub Packages
90+
if: steps.semantic-release.outputs.new-release-published == 'true'
91+
uses: actions/setup-node@v4
92+
with:
93+
registry-url: 'https://npm.pkg.github.com'
94+
scope: '@${{ github.repository_owner }}'
95+
96+
- name: Publish to GitHub Packages
97+
if: steps.semantic-release.outputs.new-release-published == 'true'
98+
run: |
99+
# Update package name for GitHub Packages (must be lowercase)
100+
npm pkg set name="@mearman/mcp-template"
101+
# Ensure we're publishing to GitHub Packages registry
102+
npm config set registry https://npm.pkg.github.com/
103+
# Skip prepublishOnly script to avoid running tests with modified package name
104+
npm publish --access public --provenance --ignore-scripts
105+
env:
106+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+

.releaserc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[
88
"@semantic-release/npm",
99
{
10-
"npmPublish": true,
10+
"npmPublish": false,
1111
"pkgRoot": "."
1212
}
1313
],

package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
{
2-
"name": "@mearman/mcp-template",
2+
"name": "mcp-template",
33
"version": "1.1.1",
44
"description": "Template for building MCP (Model Context Protocol) servers with TypeScript",
55
"main": "dist/index.js",
66
"bin": "dist/index.js",
77
"type": "module",
8-
"publishConfig": {
9-
"access": "public",
10-
"registry": "https://npm.pkg.github.com"
11-
},
128
"scripts": {
139
"build": "tsc",
1410
"dev": "tsx watch src/index.ts",

0 commit comments

Comments
 (0)