diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8a65d27 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,54 @@ +name: Release + +on: + push: + branches: + - "master" + paths: + - 'rockspec/**' + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Lua + uses: leafo/gh-actions-lua@v8 + + - name: Install Luarocks + uses: leafo/gh-actions-luarocks@v4 + + - name: Extract release name + id: release_env + shell: bash + run: | + title="${{ github.event.head_commit.message }}" + re="^feat: release v*(\S+)" + if [[ $title =~ $re ]]; then + v=v${BASH_REMATCH[1]} + echo "##[set-output name=version;]${v}" + echo "##[set-output name=version_withou_v;]${BASH_REMATCH[1]}" + else + echo "commit format is not correct" + exit 1 + fi + + - name: Create Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.release_env.outputs.version }} + release_name: ${{ steps.release_env.outputs.version }} + draft: false + prerelease: false + + - name: Upload to luarocks + env: + LUAROCKS_TOKEN: ${{ secrets.LUAROCKS_TOKEN }} + run: | + luarocks install dkjson + luarocks upload rockspec/lua-resty-radixtree-${{ steps.release_env.outputs.version_withou_v }}-0.rockspec --api-key=${LUAROCKS_TOKEN} diff --git a/.gitignore b/.gitignore index f46dc1f..6abcfd6 100644 --- a/.gitignore +++ b/.gitignore @@ -54,4 +54,6 @@ dkms.conf # t/servroot .* +!.github/ +!.travis.yml deps diff --git a/rockspec/lua-resty-radixtree-2.8.1-0.rockspec b/rockspec/lua-resty-radixtree-2.8.1-0.rockspec new file mode 100644 index 0000000..1d112cb --- /dev/null +++ b/rockspec/lua-resty-radixtree-2.8.1-0.rockspec @@ -0,0 +1,37 @@ +package = "lua-resty-radixtree" +version = "2.8.1-0" +source = { + url = "git://github.com/api7/lua-resty-radixtree", + branch = "v2.8.1", +} + +description = { + summary = "Adaptive Radix Trees implemented in Lua for Nginx + Lua", + homepage = "https://github.com/api7/lua-resty-radixtree", + license = "Apache License 2.0", +} + +dependencies = { + "lua-resty-ipmatcher", + "lua-resty-expr = 1.3.0", +} + +build = { + type = "make", + build_variables = { + CFLAGS="$(CFLAGS) -std=c99 -g -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast", + LIBFLAG="$(LIBFLAG)", + LUA_LIBDIR="$(LUA_LIBDIR)", + LUA_BINDIR="$(LUA_BINDIR)", + LUA_INCDIR="$(LUA_INCDIR)", + LUA="$(LUA)", + }, + install_variables = { + INST_PREFIX="$(PREFIX)", + INST_BINDIR="$(BINDIR)", + INST_LIBDIR="$(LIBDIR)", + INST_LUADIR="$(LUADIR)", + INST_CONFDIR="$(CONFDIR)", + }, +} +