From 3edc0fa3ade8e59428025f5eeaa4f1ae249997f7 Mon Sep 17 00:00:00 2001 From: "Wu, Zhenyu" Date: Mon, 29 Jul 2024 23:05:28 +0800 Subject: [PATCH] ci: publish to luarocks https://github.com/nvim-neorocks/rocks.nvim/issues/111 --- .github/workflows/luarocks.yml | 21 +++++++++++++++++ template.rockspec | 42 ++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 .github/workflows/luarocks.yml create mode 100644 template.rockspec diff --git a/.github/workflows/luarocks.yml b/.github/workflows/luarocks.yml new file mode 100644 index 00000000..0e5c2ff1 --- /dev/null +++ b/.github/workflows/luarocks.yml @@ -0,0 +1,21 @@ +--- +"on": + push: + paths-ignore: + - "**.md" + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: nvim-neorocks/luarocks-tag-release@v5 + env: + LUAROCKS_API_KEY: ${{secrets.LUAROCKS_API_KEY}} + if: "! startsWith(github.ref, 'refs/tags/')" + with: + extra_luarocks_args: | + --force + version: scm + template: template.rockspec diff --git a/template.rockspec b/template.rockspec new file mode 100644 index 00000000..2ecbe674 --- /dev/null +++ b/template.rockspec @@ -0,0 +1,42 @@ +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', + detailed = $detailed_description, + labels = $labels, + homepage = '$homepage', + $license +} + +dependencies = $dependencies + +test_dependencies = $test_dependencies + +source = { + url = repo_url .. '/archive/' .. git_ref .. '.zip', + dir = '$repo_name-' .. '$archive_dir_suffix', +} + +if modrev == 'scm' or modrev == 'dev' then + source = { + url = repo_url:gsub('https', 'git') + } +end + +build = { + type = 'builtin', + copy_directories = $copy_directories, + install = { + conf = { + ['..'] = 'package.json' + } + } +}