Skip to content

Commit 9780b8d

Browse files
authored
Merge pull request #2 from Mearman/fix-semantic-release-npm-publish
fix: configure semantic-release to publish to GitHub Packages
2 parents c432ba7 + e91777e commit 9780b8d

File tree

3 files changed

+11
-27
lines changed

3 files changed

+11
-27
lines changed

.github/workflows/semantic-release.yml

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

3334
- name: Enable Corepack
3435
run: corepack enable
@@ -46,8 +47,8 @@ jobs:
4647
id: semantic-release
4748
env:
4849
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49-
NPM_TOKEN: ${{ secrets.NPM_TOKEN || '' }}
50-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN || '' }}
50+
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5152
run: |
5253
# Capture the current version before release
5354
CURRENT_VERSION=$(node -p "require('./package.json').version")
@@ -86,21 +87,3 @@ jobs:
8687
subject-path: './dist'
8788
sbom-path: './sbom.spdx.json'
8889

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 }}

.releaserc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
[
88
"@semantic-release/npm",
99
{
10-
"npmPublish": true
10+
"npmPublish": true,
11+
"pkgRoot": "."
1112
}
1213
],
1314
[

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
{
2-
"name": "mcp-template",
2+
"name": "@mearman/mcp-template",
33
"version": "1.1.0",
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+
},
812
"scripts": {
913
"build": "tsc",
1014
"dev": "tsx watch src/index.ts",
@@ -30,10 +34,6 @@
3034
"type": "git",
3135
"url": "git+https://github.com/Mearman/mcp-template.git"
3236
},
33-
"publishConfig": {
34-
"access": "public",
35-
"registry": "https://registry.npmjs.org/"
36-
},
3737
"files": [
3838
"dist/**/*.js",
3939
"dist/**/*.d.ts",

0 commit comments

Comments
 (0)