diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 8033f75..c8904be 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -16,6 +16,68 @@ jobs: runs-on: ubuntu-latest steps: - uses: googleapis/release-please-action@v4 + id: release with: token: ${{ secrets.PAT }} - release-type: simple + # release-type: simple is configured in release-please-config.json + + - name: Checkout repository + if: ${{ steps.release.outputs.release_created }} + uses: actions/checkout@v4 + with: + ref: ${{ steps.release.outputs.tag_name }} + + - name: Install System Dependencies + if: ${{ steps.release.outputs.release_created }} + run: | + sudo apt-get update -qq + sudo apt-get install -y -qq build-essential cmake luarocks lua5.4 liblua5.4-dev + + - name: Install Lux + if: ${{ steps.release.outputs.release_created }} + uses: lumen-oss/gh-actions-lux@v1 + with: + version: 0.25.3 + + - name: Install just + if: ${{ steps.release.outputs.release_created }} + run: | + mkdir -p /tmp/just + curl -L https://github.com/casey/just/releases/download/1.48.1/just-1.48.1-x86_64-unknown-linux-musl.tar.gz -o /tmp/just/just.tar.gz + tar -xzf /tmp/just/just.tar.gz -C /tmp/just + sudo mv /tmp/just/just /usr/local/bin/ + rm -rf /tmp/just + + - name: Build Executable + if: ${{ steps.release.outputs.release_created }} + env: + LUA_VERSION: "5.4" + LUA_PREFIX: "/usr" + LUA_LIB: "/usr/lib/x86_64-linux-gnu/liblua5.4.a" + run: | + just build + sha256sum roda > roda.sha256 + + - name: Generate Rockspec + if: ${{ steps.release.outputs.release_created }} + run: | + lx generate-rockspec + + - name: Validate Rockspec + if: ${{ steps.release.outputs.release_created }} + run: | + luarocks lint *.rockspec + + - name: Upload Release Artifacts + if: ${{ steps.release.outputs.release_created }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release upload ${{ steps.release.outputs.tag_name }} roda roda.sha256 *.rockspec + + - name: Publish to LuaRocks + if: ${{ steps.release.outputs.release_created }} + env: + LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }} + run: | + luarocks upload *.rockspec --api-key=${LUAROCKS_API_KEY} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..ffb929a --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.12.1" +} \ No newline at end of file diff --git a/justfile b/justfile index bc82f25..3d8b947 100644 --- a/justfile +++ b/justfile @@ -37,12 +37,13 @@ set positional-arguments := true # Lua installation prefix (default: brew --prefix lua on macOS, /usr on other platforms) lua_prefix := env('LUA_PREFIX', if os() == "macos" { `brew --prefix lua` } else { "/usr" }) -# Lua version for development headers (default: 5.5) -lua_version := "5.5" +# Lua version for development headers (default: 5.5 on macOS, 5.4 on Linux) +lua_version := env('LUA_VERSION', if os() == "macos" { "5.5" } else { "5.4" }) # Include path for Lua development headers (override with LUA_INCLUDE env var) lua_include := env('LUA_INCLUDE', lua_prefix / ("include/lua" + lua_version)) -# Static Lua library (adjust path if using shared library) -lua_lib := lua_prefix / "lib/liblua.a" +# Static Lua library (default: unversioned name; override with LUA_LIB env var) +lua_lib_unversioned := lua_prefix / "lib/liblua.a" +lua_lib := env('LUA_LIB', lua_lib_unversioned) macos_version := if os() == "macos" { `sw_vers -productVersion | cut -d. -f1-2` } else { "" } build_dir := absolute_path(clean(env('BUILD_DIR', '.build'))) package_name := "roda" @@ -68,12 +69,12 @@ check-env: [doc("Format Lua files")] [group('dev')] fmt: - lx --lua-version 5.5 fmt + lx --lua-version {{lua_version}} fmt [doc("Lint Lua files")] [group('dev')] lint: - lx --lua-version 5.5 check + lx --lua-version {{lua_version}} check [doc("Lint for CI (Lua 5.4)")] [group('ci')] @@ -90,7 +91,7 @@ check: lint fmt [group('test')] test-unit: @echo "Running unit tests..." - lx --lua-version 5.5 --lua-dir {{ lua_prefix }} --variables "WITH_SHARED_LIBUV=OFF" test + lx --lua-version {{lua_version}} --lua-dir {{ lua_prefix }} --variables "WITH_SHARED_LIBUV=OFF" test [doc("Alias for test-unit")] [group('test')] @@ -110,7 +111,7 @@ ensure-deps: @echo "Ensuring dependencies are installed..." CFLAGS="-I{{ lua_include }} {{ if os() == 'macos' { '-mmacosx-version-min=' + macos_version } else { '' } }}" \ {{ if os() == 'macos' { 'MACOSX_DEPLOYMENT_TARGET=' + macos_version } else { '' } }} \ - lx --lua-version 5.5 --lua-dir {{ lua_prefix }} --variables "WITH_SHARED_LIBUV=OFF" build --only-deps --no-lock + lx --lua-version {{lua_version}} --lua-dir {{ lua_prefix }} --variables "WITH_SHARED_LIBUV=OFF" build --only-deps --no-lock [doc("Build the standalone executable")] [group('build')] @@ -209,7 +210,7 @@ test-perf: build install: CFLAGS="-I{{ lua_include }} {{ if os() == 'macos' { '-mmacosx-version-min=' + macos_version } else { '' } }}" \ {{ if os() == 'macos' { 'MACOSX_DEPLOYMENT_TARGET=' + macos_version } else { '' } }} \ - lx --lua-version 5.5 --lua-dir {{ lua_prefix }} --variables "WITH_SHARED_LIBUV=OFF" build --only-deps --no-lock + lx --lua-version {{lua_version}} --lua-dir {{ lua_prefix }} --variables "WITH_SHARED_LIBUV=OFF" build --only-deps --no-lock [doc("Run spinner directly without building (development mode)")] [group('dev')] @@ -237,7 +238,7 @@ release: all [group('release')] publish: release @echo "Publishing to LuaRocks..." - lx --lua-version 5.5 publish + lx --lua-version {{lua_version}} publish # --- Maintenance --- @@ -252,4 +253,4 @@ clean: [doc("Update lux dependencies")] [group('maintenance')] update: - lx --lua-version 5.5 update + lx --lua-version {{lua_version}} update diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..cefbf33 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,14 @@ +{ + "packages": { + ".": { + "release-type": "simple", + "extra-files": [ + { + "type": "toml", + "path": "lux.toml", + "jsonpath": "$.version" + } + ] + } + } +} \ No newline at end of file