From 0eacd96af6366201bc8e96a45731a3f6b0c39caa Mon Sep 17 00:00:00 2001 From: CarlOlson Date: Tue, 3 Nov 2026 15:44:33 +0900 Subject: [PATCH 1/2] ci: publish native parser libraries on version tags --- .github/workflows/release.yml | 97 +++++++++++++++++++++++++++++++++++ README.md | 20 ++++++++ 2 files changed, 117 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9e095b1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,97 @@ +name: Native releases + +on: + push: + tags: ['v[0-9]*.[0-9]*.[0-9]*'] + pull_request: + branches: [main] + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - platform: linux-x64 + os: ubuntu-22.04 + arch: X64 + extension: so + - platform: windows-x64 + os: windows-2022 + arch: X64 + extension: dll + - platform: macos-arm64 + os: macos-15 + arch: ARM64 + extension: dylib + defaults: + run: + shell: bash + steps: + - name: Checkout repository + uses: actions/checkout@v7 + + - name: Verify runner architecture + env: + EXPECTED_ARCH: ${{ matrix.arch }} + run: test "$RUNNER_ARCH" = "$EXPECTED_ARCH" + + - name: Set up tree-sitter + uses: tree-sitter/setup-action/cli@v2 + with: + tree-sitter-ref: v0.26.11 + + - name: Run corpus tests + run: tree-sitter test + + - name: Build native library + env: + LIBRARY: tree-sitter-rescript-${{ matrix.platform }}.${{ matrix.extension }} + run: | + mkdir -p dist + tree-sitter build --output "dist/$LIBRARY" + + - name: Upload native library + uses: actions/upload-artifact@v7 + with: + name: native-${{ matrix.platform }} + path: dist/tree-sitter-rescript-${{ matrix.platform }}.${{ matrix.extension }} + if-no-files-found: error + + release: + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + needs: build + runs-on: ubuntu-22.04 + permissions: + contents: write + steps: + - name: Download native libraries + uses: actions/download-artifact@v8 + with: + pattern: native-* + merge-multiple: true + path: dist + + - name: Publish release assets + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + TAG: ${{ github.ref_name }} + run: | + if gh release view "$TAG" >/dev/null 2>&1; then + gh release upload "$TAG" dist/* --clobber + else + flags=() + if [[ "$TAG" == *-* ]]; then + flags+=(--prerelease) + fi + gh release create "$TAG" dist/* --verify-tag --generate-notes "${flags[@]}" + fi diff --git a/README.md b/README.md index 72e92ff..846171c 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,26 @@ ReScript grammar for [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) +## Native libraries + +Pushing a version tag such as `v6.0.1` builds and publishes native parser +libraries as GitHub Release assets: + +| Platform | Asset | +| --- | --- | +| Linux x64 | `tree-sitter-rescript-linux-x64.so` | +| Windows x64 | `tree-sitter-rescript-windows-x64.dll` | +| macOS ARM64 | `tree-sitter-rescript-macos-arm64.dylib` | + +These shared libraries export `tree_sitter_rescript` and use Tree-sitter language +ABI 15. Linux binaries are built on Ubuntu 22.04 and require glibc. Download the +asset for your platform and rename it as required by your editor or loader. + +The workflow runs corpus tests on all three platforms before publishing. It also +builds PRs targeting `main` and retains their binaries as workflow artifacts. +Tags containing a hyphen, such as `v6.0.1-rc.1`, create prereleases. Rerunning a +tag workflow replaces matching assets on an existing release. + ## Contributing Contributions are welcome. Here’s how you can help: From c20db2d001c1ced65cb9770ff89515b2e5789d06 Mon Sep 17 00:00:00 2001 From: CarlOlson Date: Tue, 3 Nov 2026 15:53:02 +0900 Subject: [PATCH 2/2] ci: use Ubuntu 24.04 for native releases --- .github/workflows/release.yml | 4 ++-- README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9e095b1..f8c4124 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,7 @@ jobs: matrix: include: - platform: linux-x64 - os: ubuntu-22.04 + os: ubuntu-24.04 arch: X64 extension: so - platform: windows-x64 @@ -69,7 +69,7 @@ jobs: release: if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') needs: build - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 permissions: contents: write steps: diff --git a/README.md b/README.md index 846171c..3f83aa9 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ libraries as GitHub Release assets: | macOS ARM64 | `tree-sitter-rescript-macos-arm64.dylib` | These shared libraries export `tree_sitter_rescript` and use Tree-sitter language -ABI 15. Linux binaries are built on Ubuntu 22.04 and require glibc. Download the +ABI 15. Linux binaries are built on Ubuntu 24.04 and require glibc. Download the asset for your platform and rename it as required by your editor or loader. The workflow runs corpus tests on all three platforms before publishing. It also