Skip to content

Commit ad44832

Browse files
authored
ci: add release workflow (#10)
1 parent 9cfdb83 commit ad44832

File tree

6 files changed

+2542
-9
lines changed

6 files changed

+2542
-9
lines changed

.github/workflows/release.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write # to be able to publish a GitHub release
10+
issues: write # to be able to comment on released issues
11+
pull-requests: write # to be able to comment on released pull requests
12+
id-token: write # to enable use of OIDC for npm provenance
13+
14+
env:
15+
NODE_VERSION: '20'
16+
PNPM_VERSION: '10'
17+
18+
jobs:
19+
release:
20+
name: Release
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0 # Semantic-release needs the full history
27+
28+
- name: Install pnpm
29+
uses: pnpm/action-setup@v4
30+
with:
31+
version: ${{ env.PNPM_VERSION }}
32+
33+
- name: Setup Node.js
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: ${{ env.NODE_VERSION }}
37+
cache: 'pnpm'
38+
39+
- name: Install dependencies
40+
run: pnpm install
41+
42+
- name: Verify PGP signature on git commits
43+
# This step is important for semantic-release to trust the commits
44+
# and is especially crucial if you have commit signature verification enabled.
45+
# If you don't use PGP, you might be able to remove or adjust this.
46+
# However, semantic-release often relies on git tags and history.
47+
run: |
48+
git config --global user.email "[email protected]"
49+
git config --global user.name "GitHub Actions"
50+
# The following is a placeholder and might need adjustment based on your PGP setup
51+
# if you are signing commits that semantic-release needs to analyze.
52+
# For basic operation without signed commits being a blocker for semantic-release itself,
53+
# just setting user.email and user.name is often sufficient.
54+
echo "NOTE: PGP setup for git commits in CI is a placeholder."
55+
56+
- name: Build
57+
run: pnpm run build
58+
59+
- name: Release
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_SECRET }}
63+
run: pnpm run release

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,6 @@ dist
138138
.yarn/build-state.yml
139139
.yarn/install-state.gz
140140
.pnp.*
141+
142+
# npm credentials
143+
.npmrc

.npmrc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
registry=https://registry.npmjs.org/
2+
//registry.npmjs.org/:_authToken=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
3+
config_registry=https://registry.npmjs.org/
4+
execpath=/Users/phathag/Library/pnpm/.tools/pnpm/10.10.0/node_modules/pnpm/bin/pnpm.cjs
5+
config_frozen_lockfile=
6+
config_verify_deps_before_run=false
7+
package_json=/Users/phathag/workspace/cosmology/agentic-tools/package.json
8+
command=run-script
9+
lifecycle_event=release
10+
package_name=@hyperweb/mcp-server
11+
config_node_gyp=/Users/phathag/Library/pnpm/.tools/pnpm/10.10.0/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js
12+
package_version=0.1.0
13+
lifecycle_script=semantic-release --dry-run
14+
config_user_agent=pnpm/10.10.0 npm/? node/v22.13.1 darwin arm64
15+
node_execpath=/Users/phathag/.nvm/versions/node/v22.13.1/bin/node
16+
config_config_verify_deps_before_run=
17+
config_lifecycle_script=semantic-release --dry-run
18+
config_package_bin={"hyperweb_mcp_server":"./build/index.js"}
19+
config_execpath=/Users/phathag/Library/pnpm/.tools/pnpm/10.10.0/node_modules/pnpm/bin/pnpm.cjs
20+
config_node_execpath=/Users/phathag/.nvm/versions/node/v22.13.1/bin/node
21+
config_config_frozen_lockfile=
22+
config_config_registry=https://registry.npmjs.org/
23+
config_package_version=0.1.0
24+
config_command=run-script
25+
config_lifecycle_event=release
26+
config_package_name=@hyperweb/mcp-server
27+
config_config_user_agent=pnpm/10.10.0 npm/? node/v22.13.1 darwin arm64
28+
config_config_node_gyp=/Users/phathag/Library/pnpm/.tools/pnpm/10.10.0/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js
29+
config_package_json=/Users/phathag/workspace/cosmology/agentic-tools/package.json
30+
31+
[package_bin]
32+
hyperweb_mcp_server=./build/index.js

.releaserc.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"branches": [
3+
"main"
4+
],
5+
"plugins": [
6+
"@semantic-release/commit-analyzer",
7+
"@semantic-release/release-notes-generator",
8+
"@semantic-release/changelog",
9+
"@anolilab/semantic-release-pnpm",
10+
[
11+
"@semantic-release/git",
12+
{
13+
"assets": [
14+
"package.json",
15+
"pnpm-lock.yaml",
16+
"CHANGELOG.md"
17+
],
18+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
19+
}
20+
],
21+
"@semantic-release/github"
22+
]
23+
}

package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"version": "0.1.3",
44
"description": "Model Context Protocol Hyperweb products",
55
"main": "build/index.js",
6+
"publishConfig": {
7+
"access": "public"
8+
},
69
"scripts": {
710
"build": "rm -rf build && tsc && npm run copy-assets && chmod 755 build/index.js",
811
"copy-assets": "./scripts/copy-assets.sh",
@@ -14,7 +17,8 @@
1417
"test:coverage": "vitest --coverage",
1518
"inspector": "npm run build && npm exec @modelcontextprotocol/inspector node build/index.js",
1619
"format": "biome check --write",
17-
"lint": "biome check"
20+
"lint": "biome check",
21+
"release": "semantic-release"
1822
},
1923
"keywords": [],
2024
"author": "[email protected]",
@@ -25,11 +29,16 @@
2529
"@hyperweb/mcp-server": "./build/index.js"
2630
},
2731
"devDependencies": {
32+
"@anolilab/semantic-release-pnpm": "^1.1.11",
2833
"@biomejs/biome": "1.9.4",
34+
"@semantic-release/changelog": "^6.0.3",
35+
"@semantic-release/git": "^10.0.1",
36+
"@semantic-release/github": "^11.0.2",
2937
"@types/js-yaml": "^4.0.9",
3038
"@types/node": "^22.13.10",
3139
"@types/node-fetch": "^2.6.12",
3240
"rimraf": "^6.0.1",
41+
"semantic-release": "^24.2.3",
3342
"tsx": "^4.19.3",
3443
"typescript": "^5.8.2",
3544
"vitest": "^3.1.1"

0 commit comments

Comments
 (0)