Skip to content

Commit 12e87cb

Browse files
committed
Add GitHub Actions workflow for package publishing
- Introduce a GitHub Actions workflow for automated publishing to GitHub Packages. - Ensure compatibility with versioned tags and set appropriate permissions for package management. - Update package configuration to support public access, specify Node.js version, and prepare for publishing. Signed-off-by: katsumata <12413150+winor30@users.noreply.github.com>
1 parent e864d4a commit 12e87cb

File tree

2 files changed

+60
-2
lines changed

2 files changed

+60
-2
lines changed

.github/workflows/publish.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Publish to GitHub Packages
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*' # v1.0.0 などのタグを push すると実行
7+
8+
permissions:
9+
contents: read
10+
packages: write # これが必須
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Check out repository code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Node
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 20
24+
# ここでregistry-urlを指定しておくとnpm/pnpmコマンドが自動でnpm.pkg.github.comを使用
25+
registry-url: 'https://npm.pkg.github.com'
26+
27+
- name: Install pnpm
28+
run: npm install -g pnpm
29+
30+
- name: Install dependencies
31+
run: pnpm install --frozen-lockfile
32+
33+
- name: Build
34+
run: pnpm run build
35+
36+
- name: Publish
37+
# publishConfigにregistryがある場合は --registry指定は不要。ただ明示的に指定するケースもある
38+
run: pnpm publish
39+
env:
40+
# GITHUB_TOKENは自動でActionsに渡されるが、pnpm/npmが使用するトークンはこの変数を参照
41+
# setup-node@v4 の registry-url 設定によって自動的に .npmrc が書き換わるので
42+
# NODE_AUTH_TOKEN を指定しなくても動く可能性はありますが、明示的に指定しておくのが無難です
43+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

package.json

+17-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,26 @@
22
"name": "@winor30/mcp-server-datadog",
33
"version": "0.1.0",
44
"description": "MCP server for interacting with Datadog API",
5-
"private": true,
5+
"repository": {
6+
"type": "git",
7+
"url": "https://github.com/winor30/mcp-server-datadog.git"
8+
},
69
"type": "module",
710
"bin": {
811
"mcp-server-datadog": "./build/index.js"
912
},
13+
"main": "build/index.js",
14+
"module": "build/index.js",
15+
"types": "build/index.d.ts",
1016
"files": [
11-
"build"
17+
"build",
18+
"README.md"
1219
],
20+
"access": "public",
21+
"publishConfig": {
22+
"registry": "https://npm.pkg.github.com",
23+
"access": "public"
24+
},
1325
"scripts": {
1426
"build": "tsup && node -e \"require('fs').chmodSync('build/index.js', '755')\"",
1527
"prepare": "npm run build",
@@ -34,5 +46,8 @@
3446
"tsup": "^8.3.6",
3547
"typescript": "^5.3.3",
3648
"typescript-eslint": "^8.24.1"
49+
},
50+
"engines": {
51+
"node": ">=16.17.0"
3752
}
3853
}

0 commit comments

Comments
 (0)