diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..2bd8ae8 --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,85 @@ +name: Publish npm packages + +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + id-token: write + +concurrency: + group: npm-publish + cancel-in-progress: false + +jobs: + publish: + name: Publish to npm + runs-on: ubuntu-latest + if: >- + github.event_name == 'workflow_dispatch' || + contains(github.event.head_commit.message, '[deploy]') + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + registry-url: https://registry.npmjs.org/ + + - name: Use npm 11 for trusted publishing + run: npm install -g npm@11 + + - run: npm ci + + - name: Audit production dependencies + run: npm audit --omit=dev --audit-level=moderate + + - name: Check package versions + shell: bash + run: | + set -euo pipefail + js_version=$(node -p "require('./packages/flint-js/package.json').version") + mcp_version=$(node -p "require('./packages/flint-mcp/package.json').version") + + if npm view "flint-chart@${js_version}" version >/dev/null 2>&1; then + echo "::error::flint-chart@${js_version} is already published. Bump the package version before deploying." + exit 1 + fi + + if npm view "flint-chart-mcp@${mcp_version}" version >/dev/null 2>&1; then + echo "::error::flint-chart-mcp@${mcp_version} is already published. Bump the package version before deploying." + exit 1 + fi + + echo "js_version=${js_version}" >> "$GITHUB_ENV" + echo "mcp_version=${mcp_version}" >> "$GITHUB_ENV" + + - name: Publish flint-chart + run: npm publish --workspace packages/flint-js --access public + + - name: Wait for flint-chart to resolve + shell: bash + run: | + set -euo pipefail + for attempt in {1..30}; do + if npm view "flint-chart@${js_version}" version >/dev/null 2>&1; then + npm view "flint-chart@${js_version}" version + exit 0 + fi + echo "Waiting for flint-chart@${js_version} to be visible on npm (${attempt}/30)..." + sleep 10 + done + echo "::error::flint-chart@${js_version} did not become visible on npm in time." + exit 1 + + - name: Publish flint-chart-mcp + run: npm publish --workspace packages/flint-mcp --access public + + - name: Verify published packages + run: | + npm dist-tag ls flint-chart + npm dist-tag ls flint-chart-mcp + npm view "flint-chart@${js_version}" name version license repository.url + npm view "flint-chart-mcp@${mcp_version}" name version license repository.url bin \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 603f756..d88d025 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9911,7 +9911,7 @@ }, "packages/flint-js": { "name": "flint-chart", - "version": "0.1.0", + "version": "0.1.1", "license": "MIT", "devDependencies": { "@types/node": "^20.14.10", @@ -9952,7 +9952,7 @@ }, "packages/flint-mcp": { "name": "flint-chart-mcp", - "version": "0.1.0", + "version": "0.1.1", "license": "MIT", "dependencies": { "@modelcontextprotocol/ext-apps": "^1.7.4", @@ -9962,7 +9962,7 @@ "canvas": "^3.2.3", "chart.js": "^4.4.0", "echarts": "^6.0.0", - "flint-chart": "^0.1.0", + "flint-chart": "^0.1.1", "vega": "^6.0.0", "vega-interpreter": "^2.2.1", "vega-lite": "^6.0.0", diff --git a/packages/flint-js/package.json b/packages/flint-js/package.json index 52679fb..224782c 100644 --- a/packages/flint-js/package.json +++ b/packages/flint-js/package.json @@ -1,6 +1,6 @@ { "name": "flint-chart", - "version": "0.1.0", + "version": "0.1.1", "description": "Semantic-level visualization library that compiles data + semantic types into chart specs for Vega-Lite, ECharts, and Chart.js.", "keywords": [ "visualization", @@ -15,7 +15,7 @@ ], "license": "MIT", "author": "Microsoft Corporation", - "homepage": "https://github.com/microsoft/flint-chart#readme", + "homepage": "https://microsoft.github.io/flint-chart/", "repository": { "type": "git", "url": "git+https://github.com/microsoft/flint-chart.git", diff --git a/packages/flint-mcp/package.json b/packages/flint-mcp/package.json index 06381c7..60b50ce 100644 --- a/packages/flint-mcp/package.json +++ b/packages/flint-mcp/package.json @@ -1,6 +1,6 @@ { "name": "flint-chart-mcp", - "version": "0.1.0", + "version": "0.1.1", "description": "Model Context Protocol server for Flint — compile, validate, and render semantic chart specs to Vega-Lite, ECharts, or Chart.js artifacts (PNG/SVG) in-process.", "keywords": [ "mcp", @@ -17,7 +17,7 @@ ], "license": "MIT", "author": "Microsoft Corporation", - "homepage": "https://github.com/microsoft/flint-chart/tree/main/packages/flint-mcp#readme", + "homepage": "https://microsoft.github.io/flint-chart/", "repository": { "type": "git", "url": "git+https://github.com/microsoft/flint-chart.git", @@ -69,7 +69,7 @@ "canvas": "^3.2.3", "chart.js": "^4.4.0", "echarts": "^6.0.0", - "flint-chart": "^0.1.0", + "flint-chart": "^0.1.1", "vega": "^6.0.0", "vega-interpreter": "^2.2.1", "vega-lite": "^6.0.0",