From 32b7a85416738e1ca7d250ce98ed0e0c9c530295 Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Sun, 11 Aug 2024 22:44:59 +0200 Subject: [PATCH] feat: support luarocks/rocks.nvim (#128) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hey :wave: ### 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 (https://github.com/luarocks/luarocks-site/issues/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 --- .github/workflows/luarocks.yml | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/luarocks.yml diff --git a/.github/workflows/luarocks.yml b/.github/workflows/luarocks.yml new file mode 100644 index 0000000..7591e1b --- /dev/null +++ b/.github/workflows/luarocks.yml @@ -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