From 20b05454f8c14f1565bd10053c878d9efa4faea0 Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Mon, 13 Mar 2023 20:00:33 +0100 Subject: [PATCH 1/2] feat: package for luarocks --- .github/workflows/release.yml | 19 ++++++++++++++ Makefile | 8 ++++++ README.md | 2 ++ rockspec.template | 48 +++++++++++++++++++++++++++++++++++ scripts/luarocks_install.sh | 5 ++++ 5 files changed, 82 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 Makefile create mode 100644 rockspec.template create mode 100644 scripts/luarocks_install.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..57a66b2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,19 @@ +name: "release" +on: + push: + tags: + - '*' +jobs: + luarocks-upload: + runs-on: ubuntu-latest + steps: + - uses: denoland/setup-deno@v1 + with: + deno-version: v1.x + - uses: actions/checkout@v3 + - name: LuaRocks Upload + uses: nvim-neorocks/luarocks-tag-release@v4 + env: + LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }} + with: + template: "rockspec.template" diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a096678 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +# https://github.com/luarocks/luarocks/wiki/Creating-a-Makefile-that-plays-nice-with-LuaRocks +build: + echo "Do nothing" + +install: + deno task --quiet build:fast + bash -c "mkdir -p $(INST_LUADIR)" + cp -r app client lua public $(INST_LUADIR) diff --git a/README.md b/README.md index 4cfc4f9..53654f5 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ ### :electric_plug: Installation +[![LuaRocks](https://img.shields.io/luarocks/v/toppair/peek.nvim?logo=lua&color=purple)](https://luarocks.org/modules/toppair/peek.nvim) + ```lua use({ 'toppair/peek.nvim', run = 'deno task --quiet build:fast' }) ``` diff --git a/rockspec.template b/rockspec.template new file mode 100644 index 0000000..be8772e --- /dev/null +++ b/rockspec.template @@ -0,0 +1,48 @@ +local git_ref = '$git_ref' +local modrev = '$modrev' +local specrev = '-1' + +local repo_url = '$repo_url' + +rockspec_format = '3.0' +package = '$package' +version = modrev .. specrev + +description = { + summary = '$summary', + detailed = [[ + Features: + - live update + - synchronized scrolling + - github-style look + - TeX math + - Mermaid diagrams + ]], + labels = $labels, + homepage = '$homepage', + $license +} + +dependencies = $dependencies + +source = { + url = repo_url .. '/archive/' .. git_ref .. '.zip', + dir = '$repo_name-' .. '$archive_dir_suffix', +} + +if modrev == 'scm' then + source = { + url = 'git://github.com/toppair/$repo_name', + } +end + +build = { + type = 'make', + install_variables = { + INST_PREFIX='$(PREFIX)', + INST_BINDIR='$(BINDIR)', + INST_LIBDIR='$(LIBDIR)', + INST_LUADIR='$(LUADIR)', + INST_CONFDIR='$(CONFDIR)', + }, +} diff --git a/scripts/luarocks_install.sh b/scripts/luarocks_install.sh new file mode 100644 index 0000000..c0d0956 --- /dev/null +++ b/scripts/luarocks_install.sh @@ -0,0 +1,5 @@ +#/usr/bin/env bash + +deno task --quiet build:fast +mkdir -p $(INST_LUADIR) +cp -r app client lua public $(INST_LUADIR) From d18b34509f072f829efac8b1909bbc57c20ec692 Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Fri, 7 Jul 2023 08:37:08 +0200 Subject: [PATCH 2/2] chore: bump luarocks-tag-release version --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 57a66b2..21fe8e9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ jobs: deno-version: v1.x - uses: actions/checkout@v3 - name: LuaRocks Upload - uses: nvim-neorocks/luarocks-tag-release@v4 + uses: nvim-neorocks/luarocks-tag-release@v5 env: LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }} with: