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
97 changes: 97 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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-24.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-24.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
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 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
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:
Expand Down
Loading