Skip to content
Open
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
14 changes: 13 additions & 1 deletion .github/workflows/package-crates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
description: The Rust toolchain
default: ${{vars.RUST_TOOLCHAIN || 'stable'}}
type: string
init:
description: Initialize a grammar repository
default: false
type: boolean
generate:
description: Generate the parser artifacts
default: false
Expand Down Expand Up @@ -43,7 +47,7 @@ jobs:
with:
toolchain: ${{inputs.rust-toolchain}}
- name: Set up tree-sitter CLI
if: ${{inputs.generate}}
if: ${{inputs.generate || inputs.init}}
uses: tree-sitter/setup-action/cli@v2
- name: Install dependencies
run: |-
Expand All @@ -57,6 +61,14 @@ jobs:
(.key | startswith("tree-sitter-"))
and (.key != "tree-sitter-cli")
)) | length > 0
- name: Initialize grammar repository
if: ${{inputs.init}}
run: |
while read -r grammar_dir; do
pushd "$grammar_dir"
tree-sitter init
popd > /dev/null
done < <(jq -r '.grammars[].path // "."' tree-sitter.json)
- name: Regenerate parser
if: ${{inputs.generate}}
run: |
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/package-maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ on:
description: The Java distribution
default: temurin
type: string
init:
description: Initialize a grammar repository
default: false
type: boolean
generate:
description: Generate the parser artifacts
default: false
Expand Down Expand Up @@ -90,7 +94,7 @@ jobs:
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{secrets.GPG_PRIVATE_KEY}}
- name: Set up tree-sitter CLI
if: ${{inputs.generate}}
if: ${{inputs.generate || inputs.init}}
uses: tree-sitter/setup-action/cli@v2
- name: Install dependencies
if: ${{inputs.generate}}
Expand All @@ -106,6 +110,15 @@ jobs:
(.key | startswith("tree-sitter-"))
and (.key != "tree-sitter-cli")
)) | length > 0
- name: Initialize grammar repository
if: ${{inputs.init}}
shell: bash
run: |
while read -r grammar_dir; do
pushd "$grammar_dir"
tree-sitter init
popd > /dev/null
done < <(jq -r '.grammars[].path // "."' tree-sitter.json)
- name: Regenerate parser
if: ${{inputs.generate}}
shell: bash
Expand Down
58 changes: 49 additions & 9 deletions .github/workflows/package-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
description: The NodeJS version
default: ${{vars.NODE_VERSION || '22'}}
type: string
init:
description: Initialize a grammar repository
default: false
type: boolean
generate:
description: Generate the parser artifacts
default: false
Expand Down Expand Up @@ -43,20 +47,31 @@ jobs:
- name: Set up NodeJS
uses: actions/setup-node@v7
with:
cache: npm
cache: ${{!inputs.init && 'npm' || ''}}
node-version: ${{inputs.node-version}}
- name: Install dependencies
run: npm i --omit peer --omit optional
- name: Set up tree-sitter CLI
if: ${{inputs.init}}
uses: tree-sitter/setup-action/cli@v2
- name: Initialize grammar repository
if: ${{inputs.init}}
run: |
while read -r grammar_dir; do
pushd "$grammar_dir"
tree-sitter init
popd > /dev/null
done < <(jq -r '.grammars[].path // "."' tree-sitter.json)
- name: Regenerate parser
if: ${{inputs.generate}}
run: |
while read -r grammar_dir; do
pushd "$grammar_dir"
npm x -- tree-sitter generate
tree-sitter generate
popd > /dev/null
done < <(jq -r '.grammars[].path // "."' tree-sitter.json)
env:
TREE_SITTER_ABI_VERSION: ${{inputs.abi-version}}
- name: Install dependencies
run: npm i --omit peer --omit optional
- name: Build Wasm binaries
run: |-
while read -r grammar_dir; do
Expand Down Expand Up @@ -87,20 +102,34 @@ jobs:
- name: Set up NodeJS
uses: actions/setup-node@v7
with:
cache: npm
cache: ${{!inputs.init && 'npm' || ''}}
node-version: ${{inputs.node-version}}
- name: Install dependencies
run: npm i --omit peer --omit optional
- name: Set up tree-sitter CLI
if: ${{inputs.init}}
uses: tree-sitter/setup-action/cli@v2
- name: Initialize grammar repository
if: ${{inputs.init}}
run: |
while read -r grammar_dir; do
grammar_dir="${grammar_dir%$'\r'}"
pushd "$grammar_dir"
tree-sitter init
popd > /dev/null
done < <(jq -r '.grammars[].path // "."' tree-sitter.json)
- name: Regenerate parser
if: ${{inputs.generate}}
shell: bash
run: |
while read -r grammar_dir; do
grammar_dir="${grammar_dir%$'\r'}"
pushd "$grammar_dir"
npm x -- tree-sitter generate
tree-sitter generate
popd > /dev/null
done < <(jq -r '.grammars[].path // "."' tree-sitter.json)
env:
TREE_SITTER_ABI_VERSION: ${{inputs.abi-version}}
- name: Install dependencies
run: npm i --omit peer --omit optional
- name: Build binary
run: npm x -- prebuildify -t 20.19.5
- name: Upload binaries
Expand All @@ -123,9 +152,20 @@ jobs:
- name: Set up NodeJS
uses: actions/setup-node@v7
with:
cache: npm
cache: ${{!inputs.init && 'npm' || ''}}
node-version: ${{inputs.node-version}}
registry-url: https://registry.npmjs.org/
- name: Set up tree-sitter CLI
if: ${{inputs.init}}
uses: tree-sitter/setup-action/cli@v2
- name: Initialize grammar repository
if: ${{inputs.init}}
run: |
while read -r grammar_dir; do
pushd "$grammar_dir"
tree-sitter init
popd > /dev/null
done < <(jq -r '.grammars[].path // "."' tree-sitter.json)
- name: Download binaries
uses: actions/download-artifact@v8
with:
Expand Down
27 changes: 25 additions & 2 deletions .github/workflows/package-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
description: The Python version
default: ${{vars.PYTHON_VERSION || '3.11'}}
type: string
init:
description: Initialize a grammar repository
default: false
type: boolean
generate:
description: Generate the parser artifacts
default: false
Expand Down Expand Up @@ -42,7 +46,7 @@ jobs:
with:
python-version: ${{inputs.python-version}}
- name: Set up tree-sitter CLI
if: ${{inputs.generate}}
if: ${{inputs.generate || inputs.init}}
uses: tree-sitter/setup-action/cli@v2
- name: Install dependencies
run: |-
Expand All @@ -56,6 +60,15 @@ jobs:
(.key | startswith("tree-sitter-"))
and (.key != "tree-sitter-cli")
)) | length > 0
- name: Initialize grammar repository
if: ${{inputs.init}}
shell: bash
run: |
while read -r grammar_dir; do
pushd "$grammar_dir"
tree-sitter init
popd > /dev/null
done < <(jq -r '.grammars[].path // "."' tree-sitter.json)
- name: Regenerate parser
if: ${{inputs.generate}}
shell: bash
Expand Down Expand Up @@ -94,7 +107,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v7
- name: Set up tree-sitter CLI
if: ${{inputs.generate}}
if: ${{inputs.generate || inputs.init}}
uses: tree-sitter/setup-action/cli@v2
- name: Install dependencies
shell: bash
Expand All @@ -109,6 +122,16 @@ jobs:
(.key | startswith("tree-sitter-"))
and (.key != "tree-sitter-cli")
)) | length > 0
- name: Initialize grammar repository
if: ${{inputs.init}}
shell: bash
run: |
while read -r grammar_dir; do
grammar_dir="${grammar_dir%$'\r'}"
pushd "$grammar_dir"
tree-sitter init
popd > /dev/null
done < <(jq -r '.grammars[].path // "."' tree-sitter.json)
- name: Regenerate parser
if: ${{inputs.generate}}
shell: bash
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Publish GitHub release
on:
workflow_call:
inputs:
init:
description: Initialize a grammar repository
default: false
type: boolean
generate:
description: Generate the parser artifacts
default: false
Expand Down Expand Up @@ -43,6 +47,15 @@ jobs:
(.key | startswith("tree-sitter-"))
and (.key != "tree-sitter-cli")
)) | length > 0
- name: Initialize grammar repository
if: inputs.init
shell: bash
run: |
while read -r grammar_dir; do
pushd "$grammar_dir"
tree-sitter init
popd > /dev/null
done < <(jq -r '.grammars[].path // "."' tree-sitter.json)
- name: Generate parser
if: inputs.generate
shell: bash
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ jobs:

```yaml
inputs:
init:
description: Initialize a grammar repository
default: false
type: boolean
generate:
description: Generate the parser artifacts
default: false
Expand Down Expand Up @@ -107,6 +111,10 @@ inputs:
description: The NodeJS version
default: ${{vars.NODE_VERSION || '22'}}
type: string
init:
description: Initialize a grammar repository
default: false
type: boolean
generate:
description: Generate the parser artifacts
default: false
Expand Down Expand Up @@ -137,6 +145,10 @@ inputs:
description: The Rust toolchain
default: ${{vars.RUST_TOOLCHAIN || 'stable'}}
type: string
init:
description: Initialize a grammar repository
default: false
type: boolean
generate:
description: Generate the parser artifacts
default: false
Expand Down Expand Up @@ -167,6 +179,10 @@ inputs:
description: The Python version
default: ${{vars.PYTHON_VERSION || '3.x'}}
type: string
init:
description: Initialize a grammar repository
default: false
type: boolean
generate:
description: Generate the parser artifacts
default: false
Expand Down Expand Up @@ -205,6 +221,10 @@ inputs:
description: The Java distribution
default: temurin
type: string
init:
description: Initialize a grammar repository
default: false
type: boolean
generate:
description: Generate the parser artifacts
default: false
Expand Down