diff --git a/.github/workflows/integration_tests.yaml b/.github/workflows/integration_tests.yaml index 46c1d94f..7210ffb8 100644 --- a/.github/workflows/integration_tests.yaml +++ b/.github/workflows/integration_tests.yaml @@ -16,4 +16,4 @@ jobs: run: docker build dev/ -t resty-session - name: Run tests - run: docker run -v $PWD:/test -w /test resty-session bash -c "luarocks --lua-version 5.1 make && make prove" + run: docker run -v $PWD:/test -w /test resty-session bash -c "luarocks --lua-version 5.1 make ./*.rockspec && make prove" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..c873acc7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,58 @@ +name: Release + +on: + push: + branches: + - "master" + paths: + - 'rockspecs/**' + +permissions: + contents: write + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Install Lua + uses: leafo/gh-actions-lua@v10 + + - name: Install Luarocks + uses: leafo/gh-actions-luarocks@v4 + + - name: Extract release name + id: release_env + shell: bash + env: + COMMIT_MESSAGE: ${{ github.event.head_commit.message }} + run: | + title="$COMMIT_MESSAGE" + re="^feat: release v*(\S+)" + if [[ $title =~ $re ]]; then + echo "version=v${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT" + echo "version_without_v=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT" + else + echo "commit format is not correct" + exit 1 + fi + + - name: Create Release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{ steps.release_env.outputs.version }} + run: | + gh release create "$VERSION" --title "$VERSION" --generate-notes + + - name: Upload to luarocks + env: + LUAROCKS_TOKEN: ${{ secrets.LUAROCKS_TOKEN }} + VERSION_WITHOUT_V: ${{ steps.release_env.outputs.version_without_v }} + run: | + luarocks install dkjson + luarocks upload "rockspecs/lua-resty-session-api7-${VERSION_WITHOUT_V}-0.rockspec" --api-key="${LUAROCKS_TOKEN}" diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index f37f13ac..8987e5d4 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -33,10 +33,10 @@ jobs: run: docker build dev/ -t resty-session - name: Run tests - run: docker run --network=host -v $PWD:/test -w /test resty-session bash -c "luarocks --lua-version 5.1 make && make unit" + run: docker run --network=host -v $PWD:/test -w /test resty-session bash -c "luarocks --lua-version 5.1 make ./*.rockspec && make unit" - name: Generate report - run: docker run --network=host -v $PWD:/test -w /test resty-session bash -c "luarocks --lua-version 5.1 make && luacov" + run: docker run --network=host -v $PWD:/test -w /test resty-session bash -c "luarocks --lua-version 5.1 make ./*.rockspec && luacov" - name: Print report summary run: docker run --network=host -v $PWD:/test -w /test resty-session sed -n '/Summary/,$p' luacov.report.out diff --git a/rockspecs/lua-resty-session-api7-4.1.6-0.rockspec b/rockspecs/lua-resty-session-api7-4.1.6-0.rockspec new file mode 100644 index 00000000..4bf34697 --- /dev/null +++ b/rockspecs/lua-resty-session-api7-4.1.6-0.rockspec @@ -0,0 +1,36 @@ +package = "lua-resty-session-api7" +version = "4.1.6-0" +source = { + url = "git+https://github.com/api7/lua-resty-session.git", + tag = "v4.1.6", +} +description = { + summary = "Session Library for OpenResty - Flexible and Secure", + detailed = "lua-resty-session is a secure, and flexible session library for OpenResty.", + homepage = "https://github.com/api7/lua-resty-session", + license = "BSD", +} +dependencies = { + "lua >= 5.1", + "lua-ffi-zlib >= 0.5", + "lua-resty-openssl >= 1.5.0", +} +build = { + type = "builtin", + modules = { + ["resty.session"] = "lib/resty/session.lua", + ["resty.session.dshm"] = "lib/resty/session/dshm.lua", + ["resty.session.file"] = "lib/resty/session/file.lua", + ["resty.session.file.thread"] = "lib/resty/session/file/thread.lua", + ["resty.session.file.utils"] = "lib/resty/session/file/utils.lua", + ["resty.session.memcached"] = "lib/resty/session/memcached.lua", + ["resty.session.mysql"] = "lib/resty/session/mysql.lua", + ["resty.session.postgres"] = "lib/resty/session/postgres.lua", + ["resty.session.redis"] = "lib/resty/session/redis.lua", + ["resty.session.redis.cluster"] = "lib/resty/session/redis/cluster.lua", + ["resty.session.redis.sentinel"] = "lib/resty/session/redis/sentinel.lua", + ["resty.session.redis.common"] = "lib/resty/session/redis/common.lua", + ["resty.session.shm"] = "lib/resty/session/shm.lua", + ["resty.session.utils"] = "lib/resty/session/utils.lua", + }, +}