From d3c81624dae39cf4ce931b0c5934c9edc390b196 Mon Sep 17 00:00:00 2001 From: Firas al-Khalil Date: Thu, 16 May 2024 11:05:44 +0200 Subject: [PATCH 1/2] ref: add update script that gets the latest commit. --- update/ref | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 update/ref 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 From c6b23d73537cc984cdcdcfb2844628b38b824b82 Mon Sep 17 00:00:00 2001 From: Firas al-Khalil Date: Thu, 16 May 2024 11:16:24 +0200 Subject: [PATCH 2/2] lang: get ts version from the outside, or get latest from remote --- .github/workflows/cd.yml | 1 + lang | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) 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" ]