Skip to content

Commit

Permalink
feat: luarocks support
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb authored and vhyrro committed Mar 24, 2024
1 parent 014073f commit 9766442
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/rockspec.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
local git_ref = '$git_ref'
local modrev = '$modrev'
local specrev = '$specrev'

local repo_url = '$repo_url'

rockspec_format = '3.0'
package = '$package'
version = modrev ..'-'.. specrev

description = {
summary = '$summary',
detailed = $detailed_description,
labels = $labels,
homepage = '$homepage',
$license
}

dependencies = $dependencies

test_dependencies = $test_dependencies

source = {
url = repo_url .. '/archive/' .. git_ref .. '.zip',
dir = '$repo_name-' .. '$archive_dir_suffix',
}

if modrev == 'scm' or modrev == 'dev' then
source = {
url = repo_url
}
end

build = {
type = "treesitter-parser",
lang = "norg",
sources = { "src/parser.c", "src/scanner.cc" },
copy_directories = $copy_directories,
}
37 changes: 37 additions & 0 deletions .github/workflows/luarocks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Push to Luarocks

on:
push:
tags:
- '*'
release:
types:
- created
pull_request: # test packaging on PR
workflow_dispatch:

jobs:
luarocks-upload:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Required to count the commits
- name: Get Version
run: echo "LUAROCKS_VERSION=$(git describe --abbrev=0 --tags)" >> $GITHUB_ENV

- name: Install C/C++ Compiler
uses: rlalik/setup-cpp-compiler@master
with:
compiler: clang-latest

- name: LuaRocks Upload
uses: nvim-neorocks/luarocks-tag-release@v5
env:
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
with:
version: ${{ env.LUAROCKS_VERSION }}
template: .github/rockspec.template
dependencies: |
luarocks-build-treesitter-parser >= 1.2.0
24 changes: 24 additions & 0 deletions tree-sitter-norg-scm-1.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package = "tree-sitter-norg"

version = "scm-1"

source = {
url = "git://github.com/nvim-neorg/tree-sitter-norg",
}

description = {
summary = "tree-sitter parser for norg",
homepage = "https://github.com/nvim-neorg/tree-sitter-norg",
license = "MIT"
}

dependencies = {
"lua >= 5.1",
"luarocks-build-treesitter-parser >= 1.2.0",
}

build = {
type = "treesitter-parser",
lang = "norg",
sources = { "src/parser.c", "src/scanner.cc" },
}

0 comments on commit 9766442

Please sign in to comment.