Skip to content

Commit

Permalink
ci: publish to luarocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Sep 23, 2024
1 parent bb70728 commit 40ae393
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/luarocks.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions autoload/firenvim.vim
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ function! firenvim#run() abort
let s:firenvim_done = v:true

let l:package_json = s:build_path([s:script_dir, 'package.json'])
" luarocks puts package.json to conf dir
if !filereadable(l:package_json)
let l:package_json = s:build_path([s:script_dir, 'conf', 'package.json'])
endif
let l:version = json_decode(join(readfile(l:package_json), "\n"))['version']
let l:result = { 'version': l:version }

Expand Down
42 changes: 42 additions & 0 deletions template.rockspec
Original file line number Diff line number Diff line change
@@ -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'
}
}
}

0 comments on commit 40ae393

Please sign in to comment.