This is an automated email from the ASF dual-hosted git repository.

hsluoyz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/casbin-lua-apisix-authz.git


The following commit(s) were added to refs/heads/master by this push:
     new 13a8484  ci: add tag-triggered manual release workflow
13a8484 is described below

commit 13a84844a0a3cbfac436227436bcd67fd86288f0
Author: Yang Luo <[email protected]>
AuthorDate: Fri Aug 7 00:05:47 2026 +0800

    ci: add tag-triggered manual release workflow
---
 .github/actions/setup-luarocks/action.yml |  53 +++++++++++++++
 .github/luarocks-template.rockspec        |  21 ++++++
 .github/workflows/release.yml             | 109 ++++++++++++++++++++++++++++++
 3 files changed, 183 insertions(+)

diff --git a/.github/actions/setup-luarocks/action.yml 
b/.github/actions/setup-luarocks/action.yml
new file mode 100644
index 0000000..331391b
--- /dev/null
+++ b/.github/actions/setup-luarocks/action.yml
@@ -0,0 +1,53 @@
+name: "Set up LuaRocks"
+description: >
+  Build and install LuaRocks against the Lua tree produced by 
leafo/gh-actions-lua.
+  This replaces leafo/gh-actions-luarocks, which the Apache enterprise action
+  allowlist does not permit. Actions living in this repository are always 
allowed,
+  so the same steps are kept here instead.
+
+inputs:
+  luaRocksVersion:
+    description: "The version of LuaRocks to build, as published on 
https://luarocks.org/releases/";
+    required: false
+    default: "3.13.0"
+  withLuaPath:
+    description: "Existing Lua installation to build against (./configure 
--with-lua). Defaults to the .lua directory created by leafo/gh-actions-lua."
+    required: false
+    default: ""
+
+runs:
+  using: composite
+  steps:
+    - name: Build and install LuaRocks
+      shell: bash
+      env:
+        LUAROCKS_VERSION: ${{ inputs.luaRocksVersion }}
+        WITH_LUA_PATH: ${{ inputs.withLuaPath }}
+      run: |
+        set -euo pipefail
+
+        lua_dir="${WITH_LUA_PATH:-}"
+        if [ -z "$lua_dir" ]; then
+          # Default install path used by leafo/gh-actions-lua.
+          lua_dir="${GITHUB_WORKSPACE}/.lua"
+        fi
+
+        build_dir="${RUNNER_TEMP}/.build-luarocks"
+        install_dir="${GITHUB_WORKSPACE}/.luarocks"
+
+        mkdir -p "$build_dir"
+        curl -fsSL 
"https://luarocks.org/releases/luarocks-${LUAROCKS_VERSION}.tar.gz"; \
+          | tar -xz -C "$build_dir"
+
+        cd "${build_dir}/luarocks-${LUAROCKS_VERSION}"
+        ./configure --with-lua="$lua_dir" --prefix="$install_dir"
+        make
+        make install
+
+        # Expose luarocks and the rocks tree to the following steps.
+        luarocks="${install_dir}/bin/luarocks"
+        "$luarocks" path --lr-bin >> "$GITHUB_PATH"
+        {
+          echo "LUA_PATH=;;$("$luarocks" path --lr-path)"
+          echo "LUA_CPATH=;;$("$luarocks" path --lr-cpath)"
+        } >> "$GITHUB_ENV"
diff --git a/.github/luarocks-template.rockspec 
b/.github/luarocks-template.rockspec
new file mode 100644
index 0000000..5c82694
--- /dev/null
+++ b/.github/luarocks-template.rockspec
@@ -0,0 +1,21 @@
+package = "apisix-authz"
+source = {
+   url = "git+https://github.com/apache/casbin-lua-apisix-authz.git";,
+}
+description = {
+   summary = "An authorization plugin for Apache APISIX based on Casbin",
+   detailed = "An authorization plugin for Apache APISIX based on Casbin, 
supporting access control models like ACL, RBAC, ABAC",
+   homepage = "https://github.com/apache/casbin-lua-apisix-authz";,
+   license = "Apache License 2.0",
+   maintainer = "[email protected]"
+}
+dependencies = {
+   "lua >= 5.1",
+   "casbin >= 1.16.1"
+}
+build = {
+   type = "builtin",
+   modules = {
+      ["apisix-authz"] = "apisix-authz.lua"
+   }
+}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..cde790c
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,109 @@
+name: Release
+
+# Releases are cut manually by pushing a git tag (Apache releases must be 
voted on,
+# so nothing is published automatically on merge/commit).
+#
+#   git tag v1.4.0-rc1 && git push origin v1.4.0-rc1   -> GitHub pre-release 
(for the Apache vote)
+#   git tag v1.4.0     && git push origin v1.4.0       -> GitHub release + 
LuaRocks upload
+on:
+  push:
+    tags:
+      - 'v*'
+
+permissions:
+  contents: write
+
+env:
+  # Base name of the Apache source artifact: 
apache-<ARTIFACT_ID>-<version>-incubating-src.tar.gz
+  ARTIFACT_ID: casbin-lua-apisix-authz
+
+jobs:
+  release:
+    name: GitHub Release
+    if: github.repository == 'apache/casbin-lua-apisix-authz'
+    runs-on: ubuntu-latest
+    outputs:
+      version: ${{ steps.vars.outputs.version }}
+      prerelease: ${{ steps.vars.outputs.prerelease }}
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+
+      - name: Resolve version from tag
+        id: vars
+        run: |
+          set -euo pipefail
+          TAG="${GITHUB_REF_NAME}"
+          VERSION="${TAG#v}"
+          # A "-rc<N>" suffix marks an Apache release candidate -> GitHub 
pre-release only.
+          if [[ "${VERSION}" == *-rc* ]]; then
+            PRERELEASE=true
+          else
+            PRERELEASE=false
+          fi
+          # The source artifact always carries the final version, never the rc 
suffix, so that
+          # the exact bits that were voted on can be promoted unchanged.
+          BASE_VERSION="${VERSION%%-rc*}"
+          {
+            echo "tag=${TAG}"
+            echo "version=${BASE_VERSION}"
+            echo "prerelease=${PRERELEASE}"
+          } >> "$GITHUB_OUTPUT"
+
+      - name: Build Apache source package
+        id: package
+        run: |
+          set -euo pipefail
+          NAME="apache-${ARTIFACT_ID}-${{ steps.vars.outputs.version 
}}-incubating-src"
+          mkdir -p dist
+          # git archive ships exactly what is tracked at the tag, with a 
single top-level
+          # directory named after the tarball, and no .git metadata.
+          git archive --format=tar.gz --prefix="${NAME}/" -o 
"dist/${NAME}.tar.gz" HEAD
+          (cd dist && sha512sum "${NAME}.tar.gz" > "${NAME}.tar.gz.sha512")
+          ls -l dist
+
+      - name: Create GitHub release
+        run: |
+          set -euo pipefail
+          if [ "${{ steps.vars.outputs.prerelease }}" = "true" ]; then
+            FLAG="--prerelease"
+          else
+            FLAG="--latest"
+          fi
+          gh release create "${GITHUB_REF_NAME}" \
+            --title "${GITHUB_REF_NAME}" \
+            --generate-notes \
+            ${FLAG} \
+            dist/*
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+  luarocks:
+    name: Publish to LuaRocks
+    needs: release
+    if: needs.release.outputs.prerelease == 'false'
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+
+      - name: Set up Lua
+        uses: leafo/[email protected]
+        with:
+          luaVersion: 5.1
+
+      - name: Set up luarocks
+        uses: ./.github/actions/setup-luarocks
+
+      - name: Set up CJSON
+        run: luarocks install lua-cjson
+
+      - name: Upload rockspec
+        run: |
+          set -euo pipefail
+          rv="${{ needs.release.outputs.version }}"
+          cp ./.github/luarocks-template.rockspec 
"./apisix-authz-${rv}-1.rockspec"
+          sed -i "2iversion = \"${rv}-1\"" "./apisix-authz-${rv}-1.rockspec"
+          sed -i "5i\ \ \ tag = \"v${rv}\"" "./apisix-authz-${rv}-1.rockspec"
+          cat "apisix-authz-${rv}-1.rockspec"
+          luarocks upload "apisix-authz-${rv}-1.rockspec" --force --skip-pack 
--api-key=${{ secrets.LUAROCKS_API_KEY }}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to