diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bda7e10..7176b3c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -322,15 +322,44 @@ jobs: done git push + publish-npm: + needs: + - plan + - host + runs-on: "ubuntu-22.04" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PLAN: ${{ needs.plan.outputs.val }} + if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }} + steps: + - name: Fetch npm packages + uses: actions/download-artifact@v4 + with: + pattern: artifacts-* + path: npm/ + merge-multiple: true + - uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: 'https://registry.npmjs.org' + - run: | + for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith("-npm-package.tar.gz")] | any)'); do + pkg=$(echo "$release" | jq '.artifacts[] | select(endswith("-npm-package.tar.gz"))' --raw-output) + npm publish --access public "./npm/${pkg}" + done + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + announce: needs: - plan - host - publish-homebrew-formula + - publish-npm # use "always() && ..." to allow us to wait for all publish jobs while # still allowing individual publish jobs to skip themselves (for prereleases). # "host" however must run to completion, no skipping allowed! - if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') }} + if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') && (needs.publish-npm.result == 'skipped' || needs.publish-npm.result == 'success') }} runs-on: "ubuntu-22.04" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/dist-workspace.toml b/dist-workspace.toml index f3081cc..1ec1d67 100644 --- a/dist-workspace.toml +++ b/dist-workspace.toml @@ -8,7 +8,7 @@ cargo-dist-version = "0.30.0" # CI backends to support ci = "github" # The installers to generate for each app -installers = ["shell", "powershell", "homebrew", "msi"] +installers = ["shell", "powershell", "npm", "homebrew", "msi"] # A GitHub repo to push Homebrew formulas to tap = "rust-mcp-stack/homebrew-tap" # Target platforms to build apps for (Rust target-triple syntax) @@ -16,11 +16,13 @@ targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "x86_64-apple-da # Path that installers should place binaries in install-path = "~/.rust-mcp-stack/bin" # Publish jobs to run in CI -publish-jobs = ["homebrew"] +publish-jobs = ["homebrew", "npm"] # Whether to install an updater program install-updater = false # Whether dist should create a Github Release or use an existing draft create-release = false +# A namespace to use when publishing this package to the npm registry +npm-scope = "@rustmcp" [dist.github-custom-runners] global = "ubuntu-22.04"