From ca872967645ebf81391a46e6fbaee17367264064 Mon Sep 17 00:00:00 2001 From: Vhyrro Date: Sat, 13 Apr 2024 18:38:27 +0200 Subject: [PATCH] feat: make proper luarocks workflow --- .github/workflows/luarocks.yml | 32 ++++++++++++------- .../tree-sitter-norg.rockspec.template | 31 ++++++++++++++++++ 2 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/tree-sitter-norg.rockspec.template diff --git a/.github/workflows/luarocks.yml b/.github/workflows/luarocks.yml index 65ec23f8..742be36b 100644 --- a/.github/workflows/luarocks.yml +++ b/.github/workflows/luarocks.yml @@ -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 diff --git a/.github/workflows/tree-sitter-norg.rockspec.template b/.github/workflows/tree-sitter-norg.rockspec.template new file mode 100644 index 00000000..80260fea --- /dev/null +++ b/.github/workflows/tree-sitter-norg.rockspec.template @@ -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" }, +}