|
4 | 4 | - main |
5 | 5 | pull_request: |
6 | 6 | workflow_dispatch: |
7 | | - release: |
8 | | - types: [published] |
9 | 7 |
|
10 | 8 | concurrency: |
11 | 9 | group: ${{ github.workflow }}-${{ github.ref }} |
|
94 | 92 | - name: Run ${{ matrix.runtime }} integration tests |
95 | 93 | run: pnpm --filter @modelcontextprotocol/test-integration test:integration:${{ matrix.runtime }} |
96 | 94 |
|
97 | | - publish: |
98 | | - runs-on: ubuntu-latest |
99 | | - if: github.event_name == 'release' |
100 | | - environment: release |
101 | | - needs: [build, test, test-runtimes] |
102 | | - |
103 | | - permissions: |
104 | | - contents: read |
105 | | - id-token: write |
106 | | - |
107 | | - steps: |
108 | | - - uses: actions/checkout@v6 |
109 | | - |
110 | | - - name: Install pnpm |
111 | | - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0 |
112 | | - id: pnpm-install |
113 | | - with: |
114 | | - run_install: false |
115 | | - - uses: actions/setup-node@v6 |
116 | | - with: |
117 | | - node-version: 24 |
118 | | - cache: pnpm |
119 | | - cache-dependency-path: pnpm-lock.yaml |
120 | | - registry-url: 'https://registry.npmjs.org' |
121 | | - - run: pnpm install |
122 | | - |
123 | | - - name: Determine npm tag |
124 | | - id: npm-tag |
125 | | - run: | |
126 | | - VERSION=$(node -p "require('./package.json').version") |
127 | | - # Check if this is a beta release |
128 | | - if [[ "$VERSION" == *"-beta"* ]]; then |
129 | | - echo "tag=--tag beta" >> $GITHUB_OUTPUT |
130 | | - # Check if this release is from a non-primary branch (patch/maintenance release) |
131 | | - elif [[ "${{ github.event.release.target_commitish }}" != "main" && "${{ github.event.release.target_commitish }}" != "v1.x" ]]; then |
132 | | - # Use "release-X.Y" as tag for old branch releases (e.g., "release-1.23" for 1.23.x) |
133 | | - # npm tags are mutable pointers to versions (like "latest" pointing to 1.24.3). |
134 | | - # Using "release-1.23" means users can `npm install @modelcontextprotocol/sdk@release-1.23` |
135 | | - # to get the latest patch on that minor version, and the tag updates if we |
136 | | - # release 1.23.2, 1.23.3, etc. |
137 | | - # Note: Can't use "v1.23" because npm rejects tags that look like semver ranges. |
138 | | - MAJOR_MINOR=$(echo "$VERSION" | cut -d. -f1,2) |
139 | | - echo "tag=--tag release-${MAJOR_MINOR}" >> $GITHUB_OUTPUT |
140 | | - else |
141 | | - echo "tag=" >> $GITHUB_OUTPUT |
142 | | - fi |
143 | | -
|
144 | | - - run: pnpm publish --provenance --access public ${{ steps.npm-tag.outputs.tag }} |
145 | | - env: |
146 | | - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments