fix help formatting #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release to NPM | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Check out the code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js with npm registry | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Build | |
| run: bun run build | |
| - name: Check whether local version was already published | |
| id: check | |
| run: | | |
| LOCAL=$(node -p "require('./package.json').version") | |
| LATEST=$(npm view @metabase/cli version 2>/dev/null || echo "none") | |
| ALREADY_PUBLISHED=$(npm view @metabase/cli versions --json 2>/dev/null | node -e " | |
| let raw = ''; | |
| process.stdin.on('data', (chunk) => { raw += chunk; }); | |
| process.stdin.on('end', () => { | |
| if (raw.trim().length === 0) { console.log('false'); return; } | |
| const versions = JSON.parse(raw); | |
| const list = Array.isArray(versions) ? versions : [versions]; | |
| console.log(list.includes(process.argv[1]) ? 'true' : 'false'); | |
| }); | |
| " "$LOCAL") | |
| echo "local=$LOCAL" >> $GITHUB_OUTPUT | |
| echo "latest=$LATEST" >> $GITHUB_OUTPUT | |
| if [ "$ALREADY_PUBLISHED" = "true" ]; then | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Publish to NPM | |
| if: steps.check.outputs.changed == 'true' | |
| run: npm publish --tag latest --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_RELEASE_TOKEN }} | |
| - name: Generate workflow summary | |
| run: | | |
| tee -a $GITHUB_STEP_SUMMARY << EOF | |
| ## @metabase/cli | |
| - **Local version**: ${{ steps.check.outputs.local }} | |
| - **Current \`latest\` on npm**: ${{ steps.check.outputs.latest }} | |
| - **Published this run**: ${{ steps.check.outputs.changed }} | |
| EOF |