lua-cjson icon indicating copy to clipboard operation
lua-cjson copied to clipboard

CI: upload rockspec to LuaRocks on tag push

Open luau-project opened this issue 1 year ago • 0 comments

Overview

Since https://github.com/openresty/lua-cjson has become such a core dependency to a huge amount of packages on LuaRocks, this PR adds a new job to the current CI to upload the rockspec to LuaRocks once a new tag is pushed to GitHub.

Description

  • Added a upload job to CI, which uploads the rockspec to LuaRocks once a new tag is pushed to GitHub;

[!NOTE]

There is a guard to make sure that the GitHub tag matches the rockspec tag (field source.tag), failing the upload job otherwise.

Requeriments

In order to upload rockspecs to LuaRocks, a few steps are required:

  1. Generate an API key to upload rockspecs to LuaRocks:
    1. Visit https://luarocks.org/;
    2. Log in;
    3. Go to Settings;
    4. Generate a new API key and save it to store on a GitHub secret used by the upload job.
  2. Generate a GitHub secret to hold LuaRocks API key:
    1. Visit https://github.com/openresty/lua-cjson;
    2. Log in;
    3. Go to Settings > Secrets and variables > Actions and click New repository secret button;
    4. Paste LUAROCKS_APIKEY into Name field, paste LuaRocks API key generated from LuaRocks in the Secret box, and hit Add secret button.

[!IMPORTANT]

The secret name must be LUAROCKS_APIKEY, as is defined in the upload job.

Workflow Testing

Visit my fork's workflow runs https://github.com/luau-project/lua-cjson/actions and check how it ran:

luau-project avatar Nov 17 '24 23:11 luau-project