Skip to content

Commit ee1dcd8

Browse files
committed
fix: make NPM publishing optional in workflows
- Make NPM_TOKEN optional in semantic-release workflow - Add conditional check for NPM_TOKEN in release workflow - Update package name references to mcp-template - Document that NPM publishing is optional in README - Template users can now use workflows without NPM secrets
1 parent 83200f0 commit ee1dcd8

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ jobs:
103103
generate_release_notes: true
104104

105105
- name: Publish to NPM
106+
if: ${{ secrets.NPM_TOKEN != '' }}
106107
run: npm publish --access public --provenance
107108
env:
108109
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -116,7 +117,7 @@ jobs:
116117
- name: Publish to GitHub Packages
117118
run: |
118119
# Update package name for GitHub Packages
119-
npm pkg set name="@${{ github.repository_owner }}/mcp-wayback-machine"
120+
npm pkg set name="@${{ github.repository_owner }}/mcp-template"
120121
npm publish --access public --provenance
121122
env:
122123
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/semantic-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ jobs:
4646
id: semantic-release
4747
env:
4848
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
50-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
49+
NPM_TOKEN: ${{ secrets.NPM_TOKEN || '' }}
50+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN || '' }}
5151
run: |
5252
# Capture the current version before release
5353
CURRENT_VERSION=$(node -p "require('./package.json').version")
@@ -97,7 +97,7 @@ jobs:
9797
if: steps.semantic-release.outputs.new-release-published == 'true'
9898
run: |
9999
# Update package name for GitHub Packages (must be lowercase)
100-
npm pkg set name="@mearman/mcp-wayback-machine"
100+
npm pkg set name="@mearman/mcp-template"
101101
# Ensure we're publishing to GitHub Packages registry
102102
npm config set registry https://npm.pkg.github.com/
103103
# Skip prepublishOnly script to avoid running tests with modified package name

.releaserc.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
"@semantic-release/commit-analyzer",
55
"@semantic-release/release-notes-generator",
66
"@semantic-release/changelog",
7-
"@semantic-release/npm",
7+
[
8+
"@semantic-release/npm",
9+
{
10+
"npmPublish": true
11+
}
12+
],
813
[
914
"@semantic-release/git",
1015
{

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ This template includes semantic-release for automated versioning and publishing:
178178
- Determine version bump
179179
- Update CHANGELOG.md
180180
- Create GitHub release
181-
- Publish to npm
181+
- Publish to npm (if NPM_TOKEN secret is configured)
182+
183+
**Note**: NPM publishing is optional. If you don't want to publish to npm, simply don't add the `NPM_TOKEN` secret to your repository. The release process will still create GitHub releases.
182184

183185
## Best Practices
184186

0 commit comments

Comments
 (0)