name: Release on: release: types: [published] env: # onnxruntime-node (through @huggingface/transformers in @crowdcode/redaction) # downloads its CUDA build on Linux x64 at install time, and the v1.21.0 GPU # asset now answers 404, which fails `npm ci`. Nothing here uses the CUDA # provider; the CPU runtime ships in the package. ONNXRUNTIME_NODE_INSTALL_CUDA: skip jobs: publish: if: ${{ !github.event.release.prerelease }} runs-on: ubuntu-latest permissions: contents: read id-token: write steps: - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 - uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6 with: node-version: '24' registry-url: https://registry.npmjs.org package-manager-cache: false - name: Verify release tag matches package version env: RELEASE_TAG: ${{ github.event.release.tag_name }} run: | node --input-type=module -e ' import { readFileSync } from "node:fs"; const { version } = JSON.parse(readFileSync("packages/mcp/package.json", "utf8")); if (process.env.RELEASE_TAG !== `v${version}`) throw new Error("Release tag must match package version"); ' - run: npm ci - run: npm run build -w @crowdcode/redaction - run: npm run typecheck -w @crowdcode/redaction -w crowdcode-mcp - run: npm test - run: npm run check:assets -w crowdcode-mcp - run: npm publish --workspace crowdcode-mcp --provenance --access public # @crowdcode/redaction has its own version. Publish it when this release # carries a version npm does not have yet: a redaction fix (0.1.1, the # transformers ^4 move) also repairs crowdcode-mcp installs pinned to an # older version, which resolve ^0.1.x. Needs npm trusted publishing set # for @crowdcode/redaction (this repository, release.yml); without it the # step fails visibly and crowdcode-mcp, already published above, is # unaffected. - name: Publish @crowdcode/redaction if its version is new continue-on-error: true run: | version=$(node -p 'require("./packages/redaction/package.json").version') if npm view "@crowdcode/redaction@${version}" version >/dev/null 2>&1; then echo "@crowdcode/redaction ${version} is already published" else npm publish --workspace @crowdcode/redaction --provenance --access public fi