From 553a1cc5bfa58a69cc1d92931c59fc82e115a5fd Mon Sep 17 00:00:00 2001 From: Michael Latman Date: Tue, 26 Nov 2024 20:58:42 -0500 Subject: [PATCH] Add publishing to npm using github actions --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/michaellatman/mcp-get?shareId=XXXX-XXXX-XXXX-XXXX). --- .github/workflows/publish.yml | 30 ++++++++++++++++++++++++++++++ package.json | 10 ++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..8005819 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,30 @@ +name: Publish to npm + +on: + push: + branches: + - main + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Install dependencies + run: npm install + + - name: Build project + run: npm run build + + - name: Publish to npm + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index e1a60cb..8ad08fb 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "main": "dist/index.js", "scripts": { "build": "tsc", - "start": "node dist/index.js" + "start": "node dist/index.js", + "publish": "npm publish" }, "bin": { "mcp-get": "dist/index.js" @@ -15,5 +16,10 @@ }, "devDependencies": { "@types/node": "^14.0.0" - } + }, + "files": [ + "dist", + "README.md", + "package.json" + ] }