Skip to content

Commit 5bd4e33

Browse files
committed
fix: correct npm publish and tags for github so it works
1 parent 6332020 commit 5bd4e33

3 files changed

Lines changed: 32 additions & 12 deletions

File tree

.github/workflows/cd.yml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,31 @@ jobs:
3939
- name: Run tests
4040
run: npm run test
4141

42-
- name: Bump version locally (not committed)
43-
run: npm version patch -m "chore(release)"
42+
- name: Configure git user
43+
run: |
44+
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
45+
git config --global user.name "${{ github.actor }}"
46+
47+
- name: Get latest version from git tags
48+
id: get_version
49+
run: |
50+
# Get the latest version tag, default to 0.0.0 if none exists
51+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
52+
# Remove 'v' prefix and increment patch version
53+
VERSION=${LATEST_TAG#v}
54+
IFS='.' read -r major minor patch <<< "$VERSION"
55+
NEW_PATCH=$((patch + 1))
56+
NEW_VERSION="${major}.${minor}.${NEW_PATCH}"
57+
echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT
58+
echo "Previous version: ${VERSION}, New version: ${NEW_VERSION}"
59+
60+
- name: Update package.json version
61+
run: npm version ${{ steps.get_version.outputs.new_version }} --no-git-tag-commit
4462

4563
- name: Publish to npm
4664
id: npm_publish
4765
run: |
66+
npm whoami
4867
npm publish --access public
4968
5069
- name: Get package version
@@ -57,11 +76,6 @@ jobs:
5776
run: |
5877
git config user.name "github-actions[bot]"
5978
git config user.email "github-actions[bot]@users.noreply.github.com"
60-
# Check if the tag already exists remotely or locally
61-
if git rev-parse "refs/tags/v${{ steps.package_version.outputs.version }}" >/dev/null 2>&1 || \
62-
git ls-remote --tags origin | grep -q "refs/tags/v${{ steps.package_version.outputs.version }}$"; then
63-
echo "Tag v${{ steps.package_version.outputs.version }} already exists. Skipping tag creation."
64-
else
65-
git tag v${{ steps.package_version.outputs.version }}
66-
git push origin v${{ steps.package_version.outputs.version }}
67-
fi
79+
VERSION=${{ steps.package_version.outputs.version }}
80+
git tag v${VERSION}
81+
git push origin v${VERSION}

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ Error: Server does not support logging (required for notifications/message)
8282

8383
You need to add the capability to your `new MCPServer`. [Use this permalink](https://github.com/modelcontextprotocol/typescript-sdk/blob/1909bbcc671b00431579ea15c7713082406b1005/src/server/index.ts#L146) to know what key you should add.
8484

85+
## Versioning
86+
87+
This package uses automated versioning managed by CI/CD. The version in `package.json` is a placeholder and will be automatically updated during the release process. Check git tags for the actual released versions.
88+
8589
## Credits
8690

8791
Huge thanks to Arabold for open sourcing [docs-mcp-server](https://github.com/arabold/docs-mcp-server). Portions of this code is heavily inspired by this library. Please use it if you need other docs servers!

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devvit/mcp",
3-
"version": "0.0.14",
3+
"version": "0.0.0",
44
"description": "MCP for Devvit things",
55
"license": "BSD-3-Clause",
66
"author": "Marcus Wood",
@@ -71,5 +71,7 @@
7171
"typescript": "5.8.2",
7272
"typescript-eslint": "8.29.0",
7373
"vitest": "3.0.8"
74-
}
74+
},
75+
"_ci_version_source": "git-tags",
76+
"_comment": "This is a placeholder version that is updated by the CD pipeline"
7577
}

0 commit comments

Comments
 (0)