Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/TimonLukas/action-static-redbean

Create a single-file cross-platform server within an executable ZIP, powered by redbean 🦞
https://github.com/TimonLukas/action-static-redbean

actions cosmopolitan cosmopolitan-libc redbean server static

Last synced: about 2 months ago
JSON representation

Create a single-file cross-platform server within an executable ZIP, powered by redbean 🦞

Awesome Lists containing this project

README

        

# Create static server executable - powered by redbean 🦞

[![license badge](https://img.shields.io/github/license/TimonLukas/action-static-redbean)](/LICENSE)
[![version badge](https://img.shields.io/github/v/release/TimonLukas/action-static-redbean)](https://github.com/TimonLukas/action-static-redbean/releases)
[![release date badge](https://img.shields.io/github/release-date/TimonLukas/action-static-redbean)](https://github.com/TimonLukas/action-static-redbean/releases)
[![issues badge](https://img.shields.io/github/issues-raw/TimonLukas/action-static-redbean)](https://github.com/TimonLukas/action-static-redbean/issues)

This GitHub action creates a single-file server that:
* runs anywhere (see [jart/cosmopolitan](https://github.com/jart/cosmopolitan))
* serves static files (with optional fallback)
* is extensible through an extensive [scripting interface](https://redbean.dev/#lua)

## Usage
```yaml
- uses: TimonLukas/action-static-redbean@v1
with:
# specifies version to be fetched from redbean.dev
version: "latest"
# Location of the finished executable
executable-name: "redbean.com"
# Location of static files to include
input: "dist"
# Fallback file (for history API-based routing), `false` to disable
fallback: "index.html"
# On launch, open the users preferred browser pointing to this path, `false` to disable
launch: "/"
# Cache redbean executable instead of fetching every time, `false` to disable
cache: true

# Example: static server for `./build/*` without fallback using redbean version x.y.z
- uses: TimonLukas/action-static-redbean@v1
with:
version: "x.y.z"
input: "build"
fallback: false
- run: mv ./redbean.com $FOO
```

## Extending behavior
Generally, anything beyond serving files statically can be approached using the LUA api. The fallback option itself is actually implemented as:

```lua
function OnHttpRequest()
if not RoutePath() then
ServeAsset('$FALLBACK')
end
end
```

To add any behavior, add `.init.lua` with your own content into your `input` directory.
Depending on your project it might be worth to look into frameworks for redbean like [`fullmoon`](https://github.com/pkulchenko/fullmoon).