Skip to content

Commit ff6b45f

Browse files
committed
use CI/CD to generate rockspec and upload luarocks
1 parent 1c89296 commit ff6b45f

File tree

4 files changed

+88
-69
lines changed

4 files changed

+88
-69
lines changed

.github/workflows/main.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
"on":
3+
push:
4+
paths-ignore:
5+
- "**.md"
6+
- doc/*
7+
pull_request:
8+
paths-ignore:
9+
- "**.md"
10+
- doc/*
11+
workflow_dispatch:
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Install dependencies
19+
run: |
20+
sudo apt-get -y update
21+
sudo apt-get -y install libgit2-dev
22+
- uses: lumen-oss/luarocks-tag-release@v7
23+
env:
24+
LUAROCKS_API_KEY: ${{secrets.LUAROCKS_API_KEY}}
25+
if: "! startsWith(github.ref, 'refs/tags/')"
26+
with:
27+
extra_luarocks_args: |
28+
--force
29+
version: scm
30+
template: template.rockspec
31+
- uses: lumen-oss/luarocks-tag-release@v7
32+
env:
33+
LUAROCKS_API_KEY: ${{secrets.LUAROCKS_API_KEY}}
34+
if: startsWith(github.ref, 'refs/tags/')
35+
with:
36+
extra_luarocks_args: |
37+
--force
38+
template: template.rockspec

rockspecs/lua-git2-0.1-1.rockspec

Lines changed: 0 additions & 35 deletions
This file was deleted.

rockspecs/lua-git2-scm-0.rockspec

Lines changed: 0 additions & 34 deletions
This file was deleted.

template.rockspec

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
local git_ref = '$git_ref'
2+
local modrev = '$modrev'
3+
local specrev = '$specrev'
4+
5+
local repo_url = '$repo_url'
6+
7+
rockspec_format = '3.0'
8+
package = '$package'
9+
version = modrev ..'-'.. specrev
10+
11+
description = {
12+
summary = '$summary',
13+
detailed = $detailed_description,
14+
labels = $labels,
15+
homepage = '$homepage',
16+
$license
17+
}
18+
19+
dependencies = $dependencies
20+
21+
test_dependencies = $test_dependencies
22+
23+
source = {
24+
url = repo_url .. '/archive/' .. git_ref .. '.zip',
25+
dir = '$repo_name-' .. '$archive_dir_suffix',
26+
}
27+
28+
if modrev == 'scm' or modrev == 'dev' then
29+
source = {
30+
url = repo_url:gsub('https', 'git')
31+
}
32+
end
33+
34+
external_dependencies = {
35+
GIT2 = {
36+
header = "git2.h",
37+
library = "git2",
38+
}
39+
}
40+
build = {
41+
type = "builtin",
42+
modules = {
43+
git2 = {
44+
sources = { "src/pre_generated-git2.nobj.c" },
45+
libraries = { "git2" },
46+
incdirs = { "$(GIT2_INCDIR)" },
47+
libdirs = { "$(GIT2_LIBDIR)" },
48+
}
49+
}
50+
}

0 commit comments

Comments
 (0)