-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ef3cd2c
Showing
11 changed files
with
541 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: "Luarocks release" | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
luarocks-release: | ||
runs-on: ubuntu-latest | ||
name: Luarocks upload | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Luarocks Upload | ||
uses: ./ | ||
env: | ||
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }} | ||
with: | ||
dependencies: | | ||
plenary.nvim | ||
telescope.nvim | ||
labels: | | ||
neovim | ||
summary: "Luarocks release workflow for GitHub" | ||
detailed_description: | | ||
This is not a real lua package. | ||
It exists for the purpose of testing the workflow. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
line_endings = "Unix" | ||
indent_type = "Spaces" | ||
indent_width = 2 | ||
quote_style = "AutoPreferSingle" | ||
call_parentheses = "NoSingleTable" | ||
collapse_simple_statement = "Never" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Contributing guide | ||
|
||
Contributions are more than welcome! | ||
|
||
## Changelog | ||
|
||
Please don't forget to add your changes to the "Unreleased" section of [the changelog](./CHANGELOG.md) (if applicable). | ||
|
||
## Commit messages | ||
|
||
This project uses [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
FROM alpine:3.17.1 AS alpine-lua | ||
|
||
ENV LUA_VERSION="5.1.5" | ||
ENV LUA_SHA1_CHECKSUM="b3882111ad02ecc6b972f8c1241647905cb2e3fc" | ||
|
||
RUN set -ex \ | ||
\ | ||
&& apk update \ | ||
&& apk upgrade \ | ||
&& apk add readline-dev \ | ||
&& apk add --no-cache --virtual .build-deps \ | ||
make \ | ||
gcc \ | ||
libc-dev \ | ||
ncurses-dev \ | ||
\ | ||
&& wget -c https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz \ | ||
-O lua.tar.gz \ | ||
&& [ "$(sha1sum lua.tar.gz | cut -d' ' -f1)" = "${LUA_SHA1_CHECKSUM}" ] \ | ||
&& tar -xzf lua.tar.gz \ | ||
&& rm lua.tar.gz \ | ||
\ | ||
&& cd lua-${LUA_VERSION} \ | ||
&& make -j"$(nproc)" linux \ | ||
&& make install \ | ||
&& cd .. \ | ||
&& rm -rf lua-${LUA_VERSION} \ | ||
\ | ||
&& apk del .build-deps | ||
|
||
FROM alpine-lua as alpine-luarocks | ||
|
||
ENV LUAROCKS_VERSION="3.9.2" | ||
ENV LUAROCKS_GPG_KEY="3FD8F43C2BB3C478" | ||
|
||
RUN set -ex \ | ||
&& apk add --no-cache gnupg \ | ||
&& gpg --keyserver keyserver.ubuntu.com --recv-keys ${LUAROCKS_GPG_KEY} \ | ||
&& wget -c https://luarocks.org/releases/luarocks-${LUAROCKS_VERSION}.tar.gz \ | ||
&& wget -c https://luarocks.org/releases/luarocks-${LUAROCKS_VERSION}.tar.gz.asc \ | ||
&& gpg --verify luarocks-${LUAROCKS_VERSION}.tar.gz.asc luarocks-${LUAROCKS_VERSION}.tar.gz \ | ||
&& apk add --no-cache build-base \ | ||
m4 \ | ||
bsd-compat-headers \ | ||
openssl \ | ||
openssl-dev \ | ||
ca-certificates \ | ||
wget \ | ||
curl \ | ||
unzip \ | ||
zip \ | ||
git \ | ||
&& tar -xzf luarocks-${LUAROCKS_VERSION}.tar.gz \ | ||
&& cd luarocks-${LUAROCKS_VERSION} \ | ||
&& ./configure --with-lua=/usr/local \ | ||
&& make build \ | ||
&& make install \ | ||
&& cd .. \ | ||
&& rm -f luarocks-${LUAROCKS_VERSION}.tar.gz \ | ||
&& rm -rf luarocks-${LUAROCKS_VERSION} | ||
|
||
FROM alpine-luarocks AS luarocks-tag-release | ||
|
||
RUN luarocks install dkjson | ||
COPY rockspec.template /rockspec.template | ||
COPY entrypoint.lua /entrypoint.lua | ||
|
||
ENTRYPOINT ["/entrypoint.lua"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Marc Jakobi | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
# [WIP] LuaRocks tag release action | ||
|
||
> :warning: | ||
> | ||
> This action is a work in progress and may be moved to another oragnisation. | ||
Publishes packages to [LuaRocks](https://luarocks.org/) when a git tag is pushed. | ||
No need to add a rockspec to your repo for each release (or at all). | ||
|
||
## Features | ||
|
||
* Can generate a [rockspec](https://github.com/luarocks/luarocks/wiki/Rockspec-format) based on repository metadata and information provided to the action. | ||
* Tests a local installation from the rockspec file before uploading. | ||
* Uploads the package to LuaRocks. | ||
* Tests the installation of the uploaded package. | ||
|
||
## Prerequisites | ||
|
||
* A Luarocks account and an [API key](https://luarocks.org/settings/api-keys). | ||
* Add the API key to your [repo's GitHub Actions secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository). | ||
|
||
## Usage | ||
|
||
Create `.github/workflows/release.yml` in your repo with the following contents: | ||
```yaml | ||
name: "Luarocks release" | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
luarocks-release: | ||
runs-on: ubuntu-latest | ||
name: Luarocks upload | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Luarocks Upload | ||
uses: MrcJkb/luarocks-release-action@master | ||
env: | ||
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }} | ||
``` | ||
## Inputs | ||
The following optional inputs can be specified using `with:` | ||
|
||
#### `name` | ||
|
||
The name of the the luarocks package. | ||
|
||
* Defaults to the repository name. | ||
|
||
#### `dependencies` | ||
|
||
Lua dependencies. | ||
Any dependencies specified here must be available on Luarocks. | ||
|
||
Example: | ||
|
||
```yaml | ||
- name: Luarocks Upload | ||
uses: MrcJkb/luarocks-release-action@master | ||
with: | ||
dependencies: | | ||
plenary.nvim | ||
telescope.nvim | ||
``` | ||
|
||
#### `labels` | ||
|
||
Labels to add to the rockspec. | ||
|
||
Example: | ||
|
||
```yaml | ||
- name: Luarocks Upload | ||
uses: MrcJkb/luarocks-release-action@master | ||
with: | ||
labels: | | ||
neovim | ||
``` | ||
|
||
#### `copy_directories` | ||
|
||
Directories in the source directory to be copied to the rock installation prefix as-is. Useful for installing documentation and other files such as samples and tests. | ||
|
||
Example to specify additional directories: | ||
|
||
```yaml | ||
- name: Luarocks Upload | ||
uses: MrcJkb/luarocks-release-action@master | ||
with: | ||
copy_directories: | | ||
doc | ||
plugin | ||
``` | ||
|
||
> :warning: | ||
> | ||
> Do not use the following directory names: `lua`, `lib`, `rock_manifest` or the name of your rockspec; those names are used by the .rock format internally, and attempting to copy directories with those names using the build.copy_directories directive will cause a clash. | ||
|
||
#### `summary` | ||
|
||
A short description of the package (one line). | ||
If excluded, this action will fetch it from your repo's about section. | ||
|
||
#### `detailed_description` | ||
|
||
A more detailed description of the package. Can be multiple lines. | ||
|
||
Example: | ||
|
||
```yaml | ||
- name: Luarocks Upload | ||
uses: MrcJkb/luarocks-release-action@master | ||
with: | ||
detailed_description: | | ||
Publishes packages to LuaRocks when a git tag is pushed. | ||
Automatically generates a rockspec from repo metadata | ||
and tests the installation before releasing. | ||
``` | ||
|
||
#### `build_type` | ||
|
||
The LuaRocks build backend. | ||
|
||
* Defaults to `builtin`. | ||
* If the installation fails, it may be necessary to [use a Makefile](https://github.com/luarocks/luarocks/wiki/Creating-a-Makefile-that-plays-nice-with-LuaRocks). | ||
|
||
Example: | ||
|
||
```yaml | ||
- name: Luarocks Upload | ||
uses: MrcJkb/luarocks-release-action@master | ||
with: | ||
build_type: 'make' | ||
``` | ||
|
||
## Limitations | ||
|
||
* This workflow only works on public repositories. | ||
* This action was designed with Neovim plugins in mind. It should work with any Luarocks package, but this has not been tested. | ||
|
||
## Acknowledgements | ||
|
||
Thanks to: | ||
|
||
* [@teto](https://github.com/teto) for the [inspiration](https://teto.github.io/posts/2022-06-22-neovim-plugin-luarocks-2.html) that kickstarted this. | ||
* [@Conni2461](https://github.com/Conni2461) for the help debugging the first drafts. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: 'Luarocks tag release' | ||
decription: 'Publish a package to Luarocks when a new tag is pushed' | ||
inputs: | ||
name: | ||
description: "The name of the your package" | ||
required: true | ||
default: ${{ github.event.repository.name }} | ||
dependencies: | ||
description: "List of Luarocks dependencies." | ||
required: true | ||
default: "" | ||
labels: | ||
description: "List of package labels." | ||
required: true | ||
default: "" | ||
copy_directories: | ||
description: "List of additional directories to copy." | ||
required: true | ||
default: "" | ||
summary: | ||
description: "Short description of the package." | ||
required: true | ||
default: "" | ||
detailed_description: | ||
summary: "Detailed description of the package." | ||
required: true | ||
default: "" | ||
build_type: | ||
summary: "'builtin' or 'make'" | ||
required: true | ||
default: "builtin" | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
args: | ||
- ${{ inputs.name }} | ||
- ${{ inputs.dependencies }} | ||
- ${{ inputs.labels }} | ||
- ${{ inputs.copy-directories }} | ||
- ${{ inputs.summary }} | ||
- ${{ inputs.detailed_description }} | ||
- ${{ inputs.build_type }} | ||
- ${{ inputs.upload }} |
Oops, something went wrong.