Skip to content

remove resources and modified write and essential tags #22

remove resources and modified write and essential tags

remove resources and modified write and essential tags #22

Workflow file for this run

name: Publish to NPM
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.19.0'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Build project
run: npm run build
- name: Check if version changed
id: version-check
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
PUBLISHED_VERSION=$(npm view @cognitionai/metabase-mcp-server version 2>/dev/null || echo "0.0.0")
echo "current=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "published=$PUBLISHED_VERSION" >> $GITHUB_OUTPUT
if [ "$CURRENT_VERSION" != "$PUBLISHED_VERSION" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "Version changed: $PUBLISHED_VERSION -> $CURRENT_VERSION"
else
echo "changed=false" >> $GITHUB_OUTPUT
echo "Version unchanged: $CURRENT_VERSION"
fi
- name: Publish to NPM
if: steps.version-check.outputs.changed == 'true'
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.COGNITION_NPM_TOKEN }}
- name: Create Git tag
if: steps.version-check.outputs.changed == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git tag "v${{ steps.version-check.outputs.current }}"
git push origin "v${{ steps.version-check.outputs.current }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Skip publishing
if: steps.version-check.outputs.changed == 'false'
run: echo "Skipping publish - version ${{ steps.version-check.outputs.current }} already published"