mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2024-12-01 18:58:34 +03:00
Build and publish each JS package separately in CI
This commit is contained in:
44
.github/workflows/typescript.yml
vendored
44
.github/workflows/typescript.yml
vendored
@@ -9,9 +9,26 @@ on:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
detect-packages:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
packages: ${{ steps.find-packages.outputs.packages }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Find JS packages
|
||||
id: find-packages
|
||||
working-directory: src
|
||||
run: |
|
||||
PACKAGES=$(find . -name package.json -not -path "*/node_modules/*" -exec dirname {} \; | sed 's/^\.\///' | jq -R -s -c 'split("\n")[:-1]')
|
||||
echo "packages=$PACKAGES" >> $GITHUB_OUTPUT
|
||||
|
||||
build:
|
||||
needs: [detect-packages]
|
||||
strategy:
|
||||
matrix:
|
||||
package: ${{ fromJson(needs.detect-packages.outputs.packages) }}
|
||||
name: Build ${{ matrix.package }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -20,14 +37,24 @@ jobs:
|
||||
node-version: 18
|
||||
cache: npm
|
||||
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- name: Install dependencies
|
||||
working-directory: src/${{ matrix.package }}
|
||||
run: npm ci
|
||||
|
||||
- name: Build package
|
||||
working-directory: src/${{ matrix.package }}
|
||||
run: npm run build
|
||||
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build, detect-packages]
|
||||
if: github.event_name == 'release'
|
||||
environment: release
|
||||
needs: build
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
package: ${{ fromJson(needs.detect-packages.outputs.packages) }}
|
||||
name: Publish ${{ matrix.package }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -41,9 +68,12 @@ jobs:
|
||||
cache: npm
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
||||
- run: npm ci
|
||||
- name: Install dependencies
|
||||
working-directory: src/${{ matrix.package }}
|
||||
run: npm ci
|
||||
|
||||
# TODO: Add --provenance once the repo is public
|
||||
- run: npm run publish-all
|
||||
- name: Publish package
|
||||
working-directory: src/${{ matrix.package }}
|
||||
run: npm publish --provenance
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user