Skip to content

Commit 4bd6a84

Browse files
committed
Add the project to Luarocks
1 parent 4d89713 commit 4bd6a84

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: LuaRocks Release
2+
on:
3+
release:
4+
types: [created]
5+
jobs:
6+
release:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout code
10+
uses: actions/checkout@v2
11+
- name: Set up Lua
12+
uses: leafo/gh-actions-lua@v8
13+
with:
14+
luaVersion: "5.4.0"
15+
- name: Delete old rockspec files
16+
run: |
17+
git rm MathParser-*.rockspec || true
18+
- name: Generate rockspec
19+
run: |
20+
lua generate_rockspec.lua ${GITHUB_REF#refs/tags/}
21+
- name: Upload to LuaRocks
22+
run: |
23+
luarocks upload --api-key ${{ secrets.LUAROCKS_API_KEY }} MathParser-${GITHUB_REF#refs/tags/}.rockspec
24+
- name: Add rockspec to repository
25+
run: |
26+
git config --local user.email "[email protected]"
27+
git config --local user.name "GitHub Action"
28+
git add MathParser-${GITHUB_REF#refs/tags/}.rockspec
29+
git commit -m "Add rockspec for version ${GITHUB_REF#refs/tags/}"
30+
git push

build/generate_rockspec.lua

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
local args = {...}
2+
local version = args[1]
3+
4+
local rockspec = [[
5+
package = "MathParser"
6+
version = "]]..version..[["
7+
source = {
8+
url = "https://github.com/ByteXenon/MathParser.lua/archive/v]]..version..[[.tar.gz"
9+
}
10+
description = {
11+
summary = "A math parser for Lua.",
12+
detailed = "An elegant Math Parser written in Lua, featuring support for adding custom operators and functions.",
13+
homepage = "https://github.com/ByteXenon/MathParser.lua",
14+
license = "MIT"
15+
}
16+
dependencies = {
17+
"lua >= 5.1"
18+
}
19+
build = {
20+
type = "builtin",
21+
modules = {
22+
["MathParser"] = "MathParser.min.lua"
23+
}
24+
}
25+
]]
26+
27+
local file = io.open("MathParser-"..version..".rockspec", "w")
28+
file:write(rockspec)
29+
file:close()

0 commit comments

Comments
 (0)