Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 171 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
name: Publish Package

on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: "Existing release tag to publish, for example v0.1.9"
required: true
type: string

permissions:
contents: read

env:
NODE_VERSION: "24"
PACKAGE_SCOPE: "@jungle-grid"
NPM_REGISTRY: "https://registry.npmjs.org"
GITHUB_PACKAGES_REGISTRY: "https://npm.pkg.github.com"
RELEASE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.tag }}

jobs:
validate:
name: Validate Package
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
outputs:
package-name: ${{ steps.package.outputs.name }}
package-version: ${{ steps.package.outputs.version }}
steps:
- name: Check out release tag
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ env.RELEASE_TAG }}

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
package-manager-cache: false

- name: Install dependencies
run: npm ci

- name: Read package metadata
id: package
run: |
name="$(npm pkg get name | tr -d '"')"
version="$(npm pkg get version | tr -d '"')"
expected_tag="v${version}"

if [ "${RELEASE_TAG}" != "${expected_tag}" ]; then
echo "Release tag ${RELEASE_TAG} does not match package version ${version}; expected ${expected_tag}." >&2
exit 1
fi

echo "name=${name}" >> "${GITHUB_OUTPUT}"
echo "version=${version}" >> "${GITHUB_OUTPUT}"

- name: Build
run: npm run build

- name: Test
run: npm test

- name: Verify package contents
run: npm pack --dry-run

publish-npm:
name: Publish to npmjs
needs: validate
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
id-token: write
steps:
- name: Check out release tag
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ env.RELEASE_TAG }}

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: ${{ env.NPM_REGISTRY }}
package-manager-cache: false

- name: Install dependencies
run: npm ci

- name: Check npmjs version
id: npm-version
env:
PACKAGE_NAME: ${{ needs.validate.outputs.package-name }}
PACKAGE_VERSION: ${{ needs.validate.outputs.package-version }}
run: |
if npm view "${PACKAGE_NAME}@${PACKAGE_VERSION}" version --registry="${NPM_REGISTRY}" >/dev/null 2>&1; then
echo "exists=true" >> "${GITHUB_OUTPUT}"
echo "${PACKAGE_NAME}@${PACKAGE_VERSION} is already published to npmjs; skipping."
else
echo "exists=false" >> "${GITHUB_OUTPUT}"
fi

- name: Build package
if: steps.npm-version.outputs.exists != 'true'
run: npm run build

- name: Publish to npmjs
if: steps.npm-version.outputs.exists != 'true'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [ -n "${NODE_AUTH_TOKEN:-}" ]; then
npm config set //registry.npmjs.org/:_authToken "${NODE_AUTH_TOKEN}"
fi

npm publish --access public --provenance --registry="${NPM_REGISTRY}"

publish-github-packages:
name: Publish to GitHub Packages
needs: validate
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
packages: write
steps:
- name: Check out release tag
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ env.RELEASE_TAG }}

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: ${{ env.GITHUB_PACKAGES_REGISTRY }}
scope: ${{ env.PACKAGE_SCOPE }}
package-manager-cache: false

- name: Install dependencies
run: npm ci

- name: Check GitHub Packages version
id: github-packages-version
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGE_NAME: ${{ needs.validate.outputs.package-name }}
PACKAGE_VERSION: ${{ needs.validate.outputs.package-version }}
run: |
if npm view "${PACKAGE_NAME}@${PACKAGE_VERSION}" version --registry="${GITHUB_PACKAGES_REGISTRY}" >/dev/null 2>&1; then
echo "exists=true" >> "${GITHUB_OUTPUT}"
echo "${PACKAGE_NAME}@${PACKAGE_VERSION} is already published to GitHub Packages; skipping."
else
echo "exists=false" >> "${GITHUB_OUTPUT}"
fi

- name: Build package
if: steps.github-packages-version.outputs.exists != 'true'
run: npm run build

- name: Publish to GitHub Packages
if: steps.github-packages-version.outputs.exists != 'true'
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm publish --registry="${GITHUB_PACKAGES_REGISTRY}"
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,15 @@ docker run --rm -p 3000:3000 \

## Publishing

Normal users should continue to run the MCP server through the public npmjs
package:

```sh
npm run build
npm pack --dry-run
npm publish --access public
npx -y @jungle-grid/mcp
```

Releases are published from GitHub Releases and version tags. The package is
distributed publicly through npmjs for normal installation, and the same package
version is also published to GitHub Packages as a repository-linked package
mirror. GitHub Packages is not the default install path for end users unless a
specific workflow requires it.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jungle-grid/mcp",
"version": "0.1.8",
"version": "0.1.9",
"description": "MCP server for Jungle Grid - submit and manage GPU workloads from any MCP-aware AI host",
"license": "MIT",
"homepage": "https://github.com/Jungle-Grid/mcp-server#readme",
Expand Down Expand Up @@ -48,6 +48,7 @@
"!dist/*.test.d.ts.map",
"!dist/*.test.js",
"!dist/*.test.js.map",
"README.md"
"README.md",
"LICENSE"
]
}
Loading