Skip to content

Commit 41a5cd0

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

4 files changed

Lines changed: 93 additions & 69 deletions

File tree

.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: lua-git2-scm-1.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: lua-git2-scm-1.rockspec

lua-git2-scm-1.rockspec

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

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.

0 commit comments

Comments
 (0)