Skip to content

Commit

Permalink
fix: rockspec and upload
Browse files Browse the repository at this point in the history
  • Loading branch information
luau-project committed Nov 10, 2024
1 parent 36b689f commit aa43ed9
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 9 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- "docs/**"

env:
ROCKSPEC_VERSION: 0.0.1
ROCKSPEC_VERSION: 0.0.2
DEV_ROCKSPEC: lua-uuid-dev-1.rockspec

jobs:
Expand Down Expand Up @@ -46,7 +46,7 @@ jobs:

- name: Set environment variable to hold the rockspec name
run: |
if ("${{ github.repository }}" -eq "luau-project/lua-uuid" -and "${{ github.ref_name }}" -eq "main" -and "${{ github.ref }}" -eq "refs/tags/v${{ env.ROCKSPEC_VERSION }}")
if ("${{ github.repository }}" -eq "luau-project/lua-uuid" -and "${{ github.ref_name }}" -eq "v${{ env.ROCKSPEC_VERSION }}" -and "${{ github.ref }}" -eq "refs/tags/v${{ env.ROCKSPEC_VERSION }}")
{
Add-Content "${{ github.env }}" "ROCKSPEC=lua-uuid-${{ env.ROCKSPEC_VERSION }}-0.rockspec";
}
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
- name: Set environment variable to hold the rockspec name
run: |
if [[ "${{ github.repository }}" == "luau-project/lua-uuid" ]] && [[ "${{ github.ref_name }}" == "main" ]] && [[ "${{ github.ref }}" == "refs/tags/v${{ env.ROCKSPEC_VERSION }}" ]];
if [[ "${{ github.repository }}" == "luau-project/lua-uuid" ]] && [[ "${{ github.ref_name }}" == "v${{ env.ROCKSPEC_VERSION }}" ]] && [[ "${{ github.ref }}" == "refs/tags/v${{ env.ROCKSPEC_VERSION }}" ]];
then
echo "ROCKSPEC=lua-uuid-${{ env.ROCKSPEC_VERSION }}-0.rockspec" >> "${{ github.env }}";
else
Expand Down Expand Up @@ -184,7 +184,7 @@ jobs:
upload-rockspec:
name: Upload rockspec
runs-on: ubuntu-latest
if: ${{ github.repository == 'luau-project/lua-uuid' && github.ref_name == 'main' && startsWith(github.ref, 'refs/tags/') }}
if: ${{ github.repository == 'luau-project/lua-uuid' && startsWith(github.ref, 'refs/tags/') }}
needs:
- build
- msys2-build
Expand All @@ -197,7 +197,7 @@ jobs:

- name: Set environment variable to hold the rockspec name
run: |
if ("${{ github.repository }}" -eq "luau-project/lua-uuid" -and "${{ github.ref_name }}" -eq "main" -and "${{ github.ref }}" -eq "refs/tags/v${{ env.ROCKSPEC_VERSION }}")
if ("${{ github.repository }}" -eq "luau-project/lua-uuid" -and "${{ github.ref_name }}" -eq "v${{ env.ROCKSPEC_VERSION }}" -and "${{ github.ref }}" -eq "refs/tags/v${{ env.ROCKSPEC_VERSION }}")
{
Add-Content "${{ github.env }}" "ROCKSPEC=lua-uuid-${{ env.ROCKSPEC_VERSION }}-0.rockspec";
}
Expand All @@ -212,7 +212,7 @@ jobs:
path: lua-uuid

- name: Install libuuid-dev
run: sudo apt install -y uuid-dev
run: sudo apt install -y uuid-dev libssl-dev

- name: Setup Lua
uses: luarocks/gh-actions-lua@v10
Expand All @@ -221,8 +221,10 @@ jobs:
uses: luarocks/gh-actions-luarocks@v5

- name: Install dependencies
run: luarocks install dkjson
working-directory: lua-uuid
run: |
luarocks install dkjson
luarocks install luasocket
luarocks install luasec
- name: Upload rockspec to LuaRocks
working-directory: lua-uuid
Expand Down
2 changes: 1 addition & 1 deletion rockspecs/lua-uuid-0.0.1-0.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ source = {

description = {
homepage = "https://github.com/luau-project/lua-uuid",
summary = [[Lightweight, native GUID / UUID library for Lua]],,
summary = [[Lightweight, native GUID / UUID library for Lua]],
detailed = [=[
lua-uuid is a lightweight, native library for Lua (5.1 and newer) to deal with Universally Unique Id (UUID).
Expand Down
100 changes: 100 additions & 0 deletions rockspecs/lua-uuid-0.0.2-0.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package = "lua-uuid"
version = "0.0.2-0"

source = {
url = "git://github.com/luau-project/lua-uuid.git",
tag = "v0.0.2"
}

description = {
homepage = "https://github.com/luau-project/lua-uuid",
summary = [[Lightweight, native GUID / UUID library for Lua]],
detailed = [=[
lua-uuid is a lightweight, native library for Lua (5.1 and newer) to deal with Universally Unique Id (UUID).
* On Linux, it uses libuuid to generate UUIDs;
* On Windows, it uses the WINAPI rpcrt4 library;
* On MacOS / iOS, it uses the CoreFoundation framework.
Visit the GitHub repository for more information.]=],
license = "MIT"
}

supported_platforms = { "linux", "win32", "mingw", "cygwin", "macosx" }

dependencies = {
"lua >= 5.1"
}

external_dependencies = {
platforms = {
linux = {
["UUID"] = {
header = "uuid/uuid.h"
}
}
}
}

local function make_plat(plat)
if (plat == "linux") then
return {
type = "builtin",
modules = {
["lua-uuid"] = {
sources = { "src/lua-uuid.c" },
libraries = { "uuid" },
defines = { "LUA_UUID_BUILD_SHARED", "LUA_UUID_USE_LIBUUID" },
incdirs = { "src", "$(UUID_INCDIR)" },
libdirs = { "$(UUID_LIBDIR)" }
}
}
}
elseif (plat == "win32" or plat == "mingw" or plat == "cygwin") then
return {
type = "builtin",
modules = {
["lua-uuid"] = {
sources = { "src/lua-uuid.c" },
libraries = { "rpcrt4" },
defines = { "LUA_UUID_BUILD_SHARED", "LUA_UUID_USE_WIN32" },
incdirs = { "src" },
libdirs = {}
}
}
}
elseif (plat == "macosx") then
return {
type = "make",
makefile = "Makefile.macosx",
build_variables = {
CFLAGS = "$(CFLAGS)",
LIBFLAG = "$(LIBFLAG)",
CFLAGS_EXTRA = "-DLUA_UUID_USE_APPLE",
LIBFLAG_EXTRA = "-framework CoreFoundation",
LUA_INCDIR = "$(LUA_INCDIR)",
LUA_LIBDIR = "$(LUA_INCDIR)/../lib",
OBJ_EXTENSION = "$(OBJ_EXTENSION)",
LIB_EXTENSION = "$(LIB_EXTENSION)"
},
install_variables = {
INSTALL_PREFIX = "$(PREFIX)",
INSTALL_LIBDIR = "$(LIBDIR)",
LUA_VERSION = "$(LUA_VERSION)",
LIB_EXTENSION = "$(LIB_EXTENSION)"
}
}
else
error("Unknown platform", 2)
end
end

build = {
platforms = {
linux = make_plat("linux"),
win32 = make_plat("win32"),
mingw = make_plat("mingw"),
cygwin = make_plat("cygwin"),
macosx = make_plat("macosx")
}
}

0 comments on commit aa43ed9

Please sign in to comment.