-
Notifications
You must be signed in to change notification settings - Fork 2.3k
93 lines (77 loc) · 2.63 KB
/
publish-to-npm-on-tag.yml
File metadata and controls
93 lines (77 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: publish-on-tag
on:
push:
tags:
- 'chrome-devtools-mcp-v*'
workflow_dispatch:
inputs:
npm-publish:
description: 'Try to publish to NPM'
default: false
type: boolean
mcp-publish:
description: 'Try to publish to MCP registry'
default: true
type: boolean
permissions:
id-token: write # Required for OIDC
contents: read
jobs:
publish-to-npm:
runs-on: ubuntu-latest
if: ${{ (github.event_name != 'workflow_dispatch') || (inputs.npm-publish && always()) }}
steps:
- name: Check out repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 2
- name: Set up Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
cache: npm
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
# Ensure npm 11.5.1 or later is installed
- name: Update npm
run: npm install -g npm@latest
- name: Install dependencies
run: npm ci
- name: Build and bundle
run: npm run bundle
env:
NODE_ENV: 'production'
- name: Publish
run: |
npm publish --provenance --access public
publish-to-mcp-registry:
runs-on: ubuntu-latest
needs: publish-to-npm
if: ${{ (github.event_name != 'workflow_dispatch' && needs.publish-to-npm.result == 'success') || (inputs.mcp-publish && always()) }}
steps:
- name: Check out repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 2
- name: Set up Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
cache: npm
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
# Ensure npm 11.5.1 or later is installed
- name: Update npm
run: npm install -g npm@latest
- name: Install dependencies
run: npm ci
- name: Build and bundle
run: npm run bundle
env:
NODE_ENV: 'production'
- name: Install MCP Publisher
run: |
export OS=$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_${OS}.tar.gz" | tar xz mcp-publisher
- name: Login to MCP Registry
run: ./mcp-publisher login github-oidc
- name: Publish to MCP Registry
run: ./mcp-publisher publish