diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..21fe8e9 --- /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@v5 + 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)