diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index c6cebb6..15faff3 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -13,6 +13,7 @@ jobs: runs-on: ${{ matrix.target.os }} env: PLATFORM: ${{ matrix.target.platform }} + TREE_SITTER_VERSION: 0.22.6 steps: - uses: actions/checkout@v2 - name: Build for ${{ matrix.target.platform }} diff --git a/lang b/lang index 435cff7..ebb4c47 100755 --- a/lang +++ b/lang @@ -52,7 +52,14 @@ shift # Clone and Build tree-sitter # # ################################################ # -tstag="0.22.6" +tstag=${TREE_SITTER_VERSION:-$(\ + git \ + -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' \ + --tags https://github.com/tree-sitter/tree-sitter '*.*.*' \ + | tail --lines=1 \ + | cut --delimiter='/' --fields=3 \ + | sed -E 's/v([0-9]+\.[0-9]+)/\1/' \ +)} TSS="$PWD/tree-sitter" # Tree Sitter Source if [ ! -d "$TSS" ] diff --git a/update/ref b/update/ref new file mode 100755 index 0000000..5e85c8c --- /dev/null +++ b/update/ref @@ -0,0 +1,15 @@ +# /usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' +set -vx + +tree_sitter='https://github.com/tree-sitter/tree-sitter' +langs=$(cat $PWD/ref | cut -d ':' -f 1) + +for lang in $langs +do + ref=$(git ls-remote "$tree_sitter-$lang" refs/heads/master | sed -E 's/^([0-9a-fA-F]+)\s.*$/\1/') + echo "$lang:$ref" >> ref.new +done + +mv ref.new ref