CI: upload rockspec to LuaRocks on tag push #106
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
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.Once a new tag is pushed, this PR partially fixes question re: luarocks packaging and releases #96 and Outdated version in LuaRocks and Releases page #102 regarding the published rockspecs on LuaRocks;
Replaced the GitHub actions
leafo/gh-actions-lua@master
andleafo/gh-actions-luarocks@master
withluarocks/gh-actions-lua@master
andluarocks/gh-actions-luarocks@master
respectively, due to the former failing to install LuaJIT. See LuaJIT.org 404 when downloading tarball leafo/gh-actions-lua#49 and Build LuaJIT rolling release from git leafo/gh-actions-lua#50.Requeriments
In order to upload rockspecs to LuaRocks, a few steps are required:
Settings
;Settings > Secrets and variables > Actions
and clickNew repository secret
button;LUAROCKS_APIKEY
into Name field, paste LuaRocks API key generated from LuaRocks in the Secret box, and hitAdd 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:
The run https://github.com/luau-project/lua-cjson/actions/runs/11882520402 happened on a branch
test-commit
, which had some modifications to allow it reach the upload job (and avoiding the final upload to LuaRocks). That run was triggered by agit push
;The run https://github.com/luau-project/lua-cjson/actions/runs/11882535036 happened on the same branch
test-commit
, but this time triggered by annotating a taggit tag -a "2.1.0.14" -m "Release v2.1.0.14"
and pushing it to the remote repogit push origin 2.1.0.14
.