Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/core-git.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Core on git

# Tags the built core library as core-v<version>, so that npm can install it from git.
on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]
workflow_dispatch:
inputs:
ref:
description: Tag or commit to build
default: main

permissions:
contents: write

concurrency:
group: core-git
cancel-in-progress: false

defaults:
run:
shell: bash

jobs:
core:
if: github.event_name != 'workflow_run' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push')
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.ref || github.event.workflow_run.head_sha }}
- uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
- name: Find the version and whether it is tagged
id: version
run: |
version=$(node -p "require('./packages/core/package.json').version")
echo "tag=core-v$version" >> "$GITHUB_OUTPUT"
if git ls-remote --exit-code origin "refs/tags/core-v$version" > /dev/null; then
echo "tagged=true" >> "$GITHUB_OUTPUT"
echo "::notice::core-v$version is already tagged."
else
echo "tagged=false" >> "$GITHUB_OUTPUT"
fi
- if: steps.version.outputs.tagged == 'false'
run: npm ci
- if: steps.version.outputs.tagged == 'false'
run: npm run build -w packages/core
- if: steps.version.outputs.tagged == 'false'
run: npm test -w packages/core
- name: Tag the packed library
if: steps.version.outputs.tagged == 'false'
env:
TAG: ${{ steps.version.outputs.tag }}
run: |
source=$(git rev-parse HEAD)
npm pack -w packages/core --pack-destination "$RUNNER_TEMP"
mkdir "$RUNNER_TEMP/core"
tar -xzf "$RUNNER_TEMP"/clickhouse-sql-syntax-*.tgz -C "$RUNNER_TEMP/core" --strip-components=1
cd "$RUNNER_TEMP/core"
git init -q
git add -A
git -c user.name="github-actions[bot]" -c user.email="41898282+github-actions[bot]@users.noreply.github.com" \
commit -qm "clickhouse-sql-syntax ${TAG#core-v}, built from $source"
git push "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git" "HEAD:refs/tags/$TAG"
7 changes: 2 additions & 5 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ in TypeScript with no runtime dependencies.

## Install

It is not on npm yet. Build it from the [repository](https://github.com/valerypetrov/clickhouse-sql-syntax) (Node.js 22 or newer)
and install the folder in your project:
It is not on npm. Each version is on git as the tag `core-v<version>`, built and ready to install:

```sh
git clone https://github.com/valerypetrov/clickhouse-sql-syntax.git
cd clickhouse-sql-syntax && npm install && npm run build -w packages/core
cd ../your-project && npm install ../clickhouse-sql-syntax/packages/core
npm install git+https://github.com/valerypetrov/clickhouse-sql-syntax.git#core-v0.5.0
```

## API
Expand Down
Loading