Skip to content

Commit

Permalink
feat: support luarocks/rocks.nvim (#128)
Browse files Browse the repository at this point in the history
Hey 👋 

### Summary

This PR is part of a push to get neovim plugins on
[LuaRocks](https://luarocks.org/labels/neovim).

See also:

- [rocks.nvim](https://github.com/nvim-neorocks/rocks.nvim), a new
luarocks-based plugin manager.
- [this blog
post](https://mrcjkb.github.io/posts/2023-01-10-luarocks-tag-release.html).

### Things done:

- Add a workflow that publishes tags to luarocks.org when a tag or
release is pushed.

### Notes:

> [!IMPORTANT]
> 
> - **For the luarocks workflow to work, someone with a luarocks.org
account will have to add their [API
key](https://luarocks.org/settings/api-keys) to this repo's [GitHub
actions
secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository)**.

- Tagged releases are installed locally and then published to
luarocks.org.
- If you push tags from a local checkout, the workflow is triggered
automatically.
- If you use GitHub releases to create tags, you may need to [add a PA
token](https://github.com/nvim-neorocks/sample-luarocks-plugin?tab=readme-ov-file#generating-a-pat-personal-access-token)
for the workflow to be triggered automatically.
- Due to a shortcoming in LuaRocks
(luarocks/luarocks-site#188), the `neovim`
and/or `vim` labels have to be added to the LuaRocks package manually
(after the first upload), for this plugin to show up in
https://luarocks.org/labels/neovim or https://luarocks.org/labels/vim,
respectively.

See also [this guide](https://github.com/vhyrro/sample-luarocks-plugin).

Co-authored-by: Ricardo Casía <[email protected]>
  • Loading branch information
mrcjkb and rcasia authored Aug 11, 2024
1 parent 62fc932 commit 32b7a85
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/luarocks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: Push to Luarocks

on:
push:
tags:
- '*'
release:
types:
- created
tags:
- '*'
pull_request: # Tests installing the generated rockspec on PR without uploading
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

# Needed to install the tree-sitter parser dependency
- name: Install C/C++ Compiler
uses: rlalik/setup-cpp-compiler@master
with:
compiler: clang-latest
- name: Install tree-sitter CLI
uses: baptiste0928/cargo-install@v3
with:
crate: tree-sitter-cli

- name: LuaRocks Upload
uses: nvim-neorocks/luarocks-tag-release@v7
env:
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
with:
version: ${{ env.LUAROCKS_VERSION }}
dependencies: |
neotest
plenary.nvim
nvim-nio
tree-sitter-java

0 comments on commit 32b7a85

Please sign in to comment.