Skip to content

Commit

Permalink
feat: make proper luarocks workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
vhyrro committed Apr 13, 2024
1 parent 9766442 commit ca87296
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 12 deletions.
32 changes: 20 additions & 12 deletions .github/workflows/luarocks.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,45 @@
---
name: Push to Luarocks

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

jobs:
luarocks-upload:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
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: Install Lua
uses: leso-kn/gh-actions-lua@master
with:
luaVersion: "5.1"
- name: Install Luarocks
uses: hishamhm/gh-actions-luarocks@master
- name: Install `luarocks-build-treesitter-parser` Package
run: |
luarocks --verbose --local --lua-version=5.1 install luarocks-build-treesitter-parser
- name: LuaRocks Upload
uses: nvim-neorocks/luarocks-tag-release@v5
env:
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
with:
name: tree-sitter-norg
version: ${{ env.LUAROCKS_VERSION }}
template: .github/rockspec.template
dependencies: |
luarocks-build-treesitter-parser >= 1.2.0
labels: |
neovim
tree-sitter
summary: The official tree-sitter parser for Norg documents.
template: .github/workflows/tree-sitter-norg.rockspec.template
31 changes: 31 additions & 0 deletions .github/workflows/tree-sitter-norg.rockspec.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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',
labels = $labels,
homepage = '$homepage',
$license
}

build_dependencies = {
'luarocks-build-treesitter-parser >= 1.3.0',
}

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

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

0 comments on commit ca87296

Please sign in to comment.