CI #93
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: CI | |
| on: | |
| push: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| CI: | |
| name: CI flow | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "yarn" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Install dependencies | |
| run: yarn install --immutable --immutable-cache | |
| - name: Build | |
| run: yarn build | |
| - name: Check if version exists on npm | |
| if: github.ref == 'refs/heads/master' | |
| id: check-version | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| if npm view @questdb/sql-grammar@$VERSION version 2>/dev/null; then | |
| echo "Version $VERSION already exists on npm" | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "Version $VERSION does not exist on npm" | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Publish @questdb/sql-grammar to npm | |
| if: github.ref == 'refs/heads/master' && steps.check-version.outputs.exists == 'false' | |
| run: npm publish --provenance --access public |