setup for luarocks releases

This commit is contained in:
Michael Freno
2025-12-06 14:19:00 -05:00
parent 5088123ad4
commit da69d8bd4f
7 changed files with 230 additions and 19 deletions

View File

@@ -15,10 +15,11 @@ This interactive script will:
2. Ask you to select: Major / Minor / Patch / Custom version bump 2. Ask you to select: Major / Minor / Patch / Custom version bump
3. Calculate the new version (resetting lower components to 0) 3. Calculate the new version (resetting lower components to 0)
4. Update `FlexLove.lua` with the new version 4. Update `FlexLove.lua` with the new version
5. Update `README.md` first line with the new version 5. Update `docs/index.html` footer version
6. Create a git commit: `v{version} release` 6. Create/update rockspec file: `flexlove-{version}-1.rockspec`
7. Create a git tag: `v{version}` 7. Create a git commit: `v{version} release`
8. Prompt you to push the changes 8. Create a git tag: `v{version}`
9. Push changes and tag to GitHub
After pushing the tag, GitHub Actions automatically: After pushing the tag, GitHub Actions automatically:
- Archives previous documentation - Archives previous documentation
@@ -26,6 +27,8 @@ After pushing the tag, GitHub Actions automatically:
- Creates 4 build profile packages (minimal, slim, default, full) with SHA256 checksums - Creates 4 build profile packages (minimal, slim, default, full) with SHA256 checksums
- Publishes GitHub release with all profile packages - Publishes GitHub release with all profile packages
The script will display next steps for publishing to LuaRocks (see [LUAROCKS_PUBLISHING.md](LUAROCKS_PUBLISHING.md)).
### Example Usage ### Example Usage
```bash ```bash
@@ -124,6 +127,7 @@ shasum -a 256 -c flexlove-*-v0.3.0.zip.sha256
## Release Checklist ## Release Checklist
- [ ] Version updated in `FlexLove.lua` - [ ] Version updated in `FlexLove.lua`
- [ ] Rockspec created/updated (automated by `make-tag.sh`)
- [ ] Documentation regenerated (`./scripts/generate_docs.sh`) - [ ] Documentation regenerated (`./scripts/generate_docs.sh`)
- [ ] Changes committed and pushed - [ ] Changes committed and pushed
- [ ] Profile packages created (`./scripts/create-profile-packages.sh`) - [ ] Profile packages created (`./scripts/create-profile-packages.sh`)
@@ -131,6 +135,7 @@ shasum -a 256 -c flexlove-*-v0.3.0.zip.sha256
- [ ] All profile packages tested - [ ] All profile packages tested
- [ ] Git tag created and pushed - [ ] Git tag created and pushed
- [ ] GitHub release published with all 4 profile packages and checksums - [ ] GitHub release published with all 4 profile packages and checksums
- [ ] Published to LuaRocks (`luarocks upload flexlove-{version}-1.rockspec`)
## Versioning ## Versioning
@@ -211,6 +216,43 @@ unzip flexlove-default-v0.3.0.zip
**macOS/Linux:** Use `shasum -a 256 -c` **macOS/Linux:** Use `shasum -a 256 -c`
**Windows:** Use `certutil -hashfile flexlove-<profile>-v0.3.0.zip SHA256` and compare manually **Windows:** Use `certutil -hashfile flexlove-<profile>-v0.3.0.zip SHA256` and compare manually
## Publishing to LuaRocks
After creating a GitHub release, publish to LuaRocks for easy installation:
### First-Time Setup
1. Create a LuaRocks account at [https://luarocks.org/register](https://luarocks.org/register)
2. Get your API key from [https://luarocks.org/settings/api-keys](https://luarocks.org/settings/api-keys)
3. Configure it locally:
```bash
luarocks config api-key YOUR_API_KEY_HERE
```
### Publishing a Release
The `make-tag.sh` script automatically creates the rockspec file. After the tag is pushed:
```bash
# Upload to LuaRocks
luarocks upload flexlove-{version}-1.rockspec
# Example for version 0.5.5:
luarocks upload flexlove-0.5.5-1.rockspec
```
### Verifying Publication
```bash
# Search for your package
luarocks search flexlove
# Test installation
luarocks install flexlove
```
For detailed instructions, see [LUAROCKS_PUBLISHING.md](LUAROCKS_PUBLISHING.md).
## Automated Releases (Future) ## Automated Releases (Future)
Consider adding GitHub Actions workflow to automate: Consider adding GitHub Actions workflow to automate:
@@ -218,5 +260,6 @@ Consider adding GitHub Actions workflow to automate:
- Release package creation - Release package creation
- Documentation deployment - Documentation deployment
- GitHub release creation - GitHub release creation
- LuaRocks publishing
See `.github/workflows/release.yml` (to be created) See `.github/workflows/release.yml` (to be created)

76
flexlove-0.5.4-1.rockspec Normal file
View File

@@ -0,0 +1,76 @@
package = "flexlove"
version = "0.5.4-1"
source = {
url = "git+https://github.com/mikefreno/FlexLove.git",
tag = "v0.5.4",
}
description = {
summary = "A comprehensive UI library providing flexbox/grid layouts, theming, animations, and event handling for LÖVE2D games",
detailed = [[
FlexLöve is a lightweight, flexible GUI library for LÖVE2D that implements a
flexbox-based layout system. The goals of this project are two-fold: first,
anyone with basic CSS knowledge should be able to use this library with minimal
learning curve. Second, this library should take you from early prototyping to
production.
Features:
- Flexbox and Grid Layout systems
- Modern theming with 9-patch support
- Animations and transitions
- Image rendering with CSS-like object-fit
- Touch events and gesture recognition
- Text input with rich editing features
- Responsive design with viewport units
- Both immediate and retained rendering modes
]],
homepage = "https://mikefreno.github.io/FlexLove/",
license = "MIT",
maintainer = "Mike Freno",
}
dependencies = {
"lua >= 5.1",
"luautf8 >= 0.1.3"
}
build = {
type = "builtin",
modules = {
["FlexLove"] = "FlexLove.lua",
["FlexLove.modules.Animation"] = "modules/Animation.lua",
["FlexLove.modules.Blur"] = "modules/Blur.lua",
["FlexLove.modules.Color"] = "modules/Color.lua",
["FlexLove.modules.Context"] = "modules/Context.lua",
["FlexLove.modules.Element"] = "modules/Element.lua",
["FlexLove.modules.ErrorHandler"] = "modules/ErrorHandler.lua",
["FlexLove.modules.EventHandler"] = "modules/EventHandler.lua",
["FlexLove.modules.FFI"] = "modules/FFI.lua",
["FlexLove.modules.GestureRecognizer"] = "modules/GestureRecognizer.lua",
["FlexLove.modules.Grid"] = "modules/Grid.lua",
["FlexLove.modules.ImageCache"] = "modules/ImageCache.lua",
["FlexLove.modules.ImageRenderer"] = "modules/ImageRenderer.lua",
["FlexLove.modules.ImageScaler"] = "modules/ImageScaler.lua",
["FlexLove.modules.InputEvent"] = "modules/InputEvent.lua",
["FlexLove.modules.LayoutEngine"] = "modules/LayoutEngine.lua",
["FlexLove.modules.MemoryScanner"] = "modules/MemoryScanner.lua",
["FlexLove.modules.ModuleLoader"] = "modules/ModuleLoader.lua",
["FlexLove.modules.NinePatch"] = "modules/NinePatch.lua",
["FlexLove.modules.Performance"] = "modules/Performance.lua",
["FlexLove.modules.Renderer"] = "modules/Renderer.lua",
["FlexLove.modules.RoundedRect"] = "modules/RoundedRect.lua",
["FlexLove.modules.ScrollManager"] = "modules/ScrollManager.lua",
["FlexLove.modules.StateManager"] = "modules/StateManager.lua",
["FlexLove.modules.TextEditor"] = "modules/TextEditor.lua",
["FlexLove.modules.Theme"] = "modules/Theme.lua",
["FlexLove.modules.types"] = "modules/types.lua",
["FlexLove.modules.Units"] = "modules/Units.lua",
["FlexLove.modules.UTF8"] = "modules/UTF8.lua",
["FlexLove.modules.utils"] = "modules/utils.lua"
},
copy_directories = {
"docs",
"examples",
},
}

View File

@@ -1,3 +1,5 @@
local UTF8 = require((...):match("(.-)[^%.]+$") .. "UTF8")
---@class Renderer ---@class Renderer
---@field backgroundColor Color ---@field backgroundColor Color
---@field borderColor Color ---@field borderColor Color
@@ -463,7 +465,7 @@ end
---@return table Array of {text, startIdx, endIdx} ---@return table Array of {text, startIdx, endIdx}
function Renderer:wrapLine(element, line, maxWidth) function Renderer:wrapLine(element, line, maxWidth)
-- UTF-8 support -- UTF-8 support
local utf8 = utf8 or require("utf8") local utf8 = UTF8
if not element.editable then if not element.editable then
return { { text = line, startIdx = 0, endIdx = utf8.len(line) } } return { { text = line, startIdx = 0, endIdx = utf8.len(line) } }

View File

@@ -1,4 +1,5 @@
local utf8 = utf8 or require("utf8") local UTF8 = require((...):match("(.-)[^%.]+$") .. "UTF8")
local utf8 = UTF8
---@class TextEditor ---@class TextEditor
---@field editable boolean ---@field editable boolean

44
modules/UTF8.lua Normal file
View File

@@ -0,0 +1,44 @@
---@class UTF8
---Compatibility layer for UTF-8 support across Lua versions
---Handles utf8 (Lua 5.3+), lua-utf8 (LuaRocks), and basic fallbacks
local UTF8 = {}
-- Try to load UTF-8 library in order of preference:
-- 1. Built-in utf8 (Lua 5.3+, LÖVE2D)
-- 2. lua-utf8 from LuaRocks (Lua 5.1, 5.2)
-- 3. Error if neither available
local function loadUTF8()
-- Try built-in utf8 first (Lua 5.3+ and LÖVE2D)
if utf8 and type(utf8) == "table" and utf8.len then
return utf8
end
-- Try lua-utf8 from LuaRocks
local ok, luautf8 = pcall(require, "lua-utf8")
if ok then
return luautf8
end
-- Try standard utf8 module name as fallback
ok, luautf8 = pcall(require, "utf8")
if ok then
return luautf8
end
-- No UTF-8 library available
error("No UTF-8 library available. Please install 'luautf8' via LuaRocks: luarocks install luautf8")
end
-- Load the UTF-8 implementation
local utf8lib = loadUTF8()
-- Export all utf8 functions
UTF8.char = utf8lib.char
UTF8.charpattern = utf8lib.charpattern
UTF8.codes = utf8lib.codes
UTF8.codepoint = utf8lib.codepoint
UTF8.len = utf8lib.len
UTF8.offset = utf8lib.offset
return UTF8

View File

@@ -55,16 +55,16 @@ get_description() {
get_modules() { get_modules() {
case "$1" in case "$1" in
minimal) minimal)
echo "utils.lua Units.lua Context.lua StateManager.lua ErrorHandler.lua Color.lua InputEvent.lua TextEditor.lua LayoutEngine.lua Renderer.lua EventHandler.lua ScrollManager.lua Element.lua RoundedRect.lua Grid.lua ModuleLoader.lua types.lua FFI.lua" echo "utils.lua Units.lua Context.lua StateManager.lua ErrorHandler.lua Color.lua InputEvent.lua TextEditor.lua LayoutEngine.lua Renderer.lua EventHandler.lua ScrollManager.lua Element.lua RoundedRect.lua Grid.lua ModuleLoader.lua types.lua FFI.lua UTF8.lua"
;; ;;
slim) slim)
echo "utils.lua Units.lua Context.lua StateManager.lua ErrorHandler.lua Color.lua InputEvent.lua TextEditor.lua LayoutEngine.lua Renderer.lua EventHandler.lua ScrollManager.lua Element.lua RoundedRect.lua Grid.lua ModuleLoader.lua types.lua FFI.lua Animation.lua NinePatch.lua ImageRenderer.lua ImageScaler.lua ImageCache.lua" echo "utils.lua Units.lua Context.lua StateManager.lua ErrorHandler.lua Color.lua InputEvent.lua TextEditor.lua LayoutEngine.lua Renderer.lua EventHandler.lua ScrollManager.lua Element.lua RoundedRect.lua Grid.lua ModuleLoader.lua types.lua FFI.lua UTF8.lua Animation.lua NinePatch.lua ImageRenderer.lua ImageScaler.lua ImageCache.lua"
;; ;;
default) default)
echo "utils.lua Units.lua Context.lua StateManager.lua ErrorHandler.lua Color.lua InputEvent.lua TextEditor.lua LayoutEngine.lua Renderer.lua EventHandler.lua ScrollManager.lua Element.lua RoundedRect.lua Grid.lua ModuleLoader.lua types.lua FFI.lua Animation.lua NinePatch.lua ImageRenderer.lua ImageScaler.lua ImageCache.lua Theme.lua Blur.lua GestureRecognizer.lua" echo "utils.lua Units.lua Context.lua StateManager.lua ErrorHandler.lua Color.lua InputEvent.lua TextEditor.lua LayoutEngine.lua Renderer.lua EventHandler.lua ScrollManager.lua Element.lua RoundedRect.lua Grid.lua ModuleLoader.lua types.lua FFI.lua UTF8.lua Animation.lua NinePatch.lua ImageRenderer.lua ImageScaler.lua ImageCache.lua Theme.lua Blur.lua GestureRecognizer.lua"
;; ;;
full) full)
echo "utils.lua Units.lua Context.lua StateManager.lua ErrorHandler.lua Color.lua InputEvent.lua TextEditor.lua LayoutEngine.lua Renderer.lua EventHandler.lua ScrollManager.lua Element.lua RoundedRect.lua Grid.lua ModuleLoader.lua types.lua FFI.lua Animation.lua NinePatch.lua ImageRenderer.lua ImageScaler.lua ImageCache.lua Theme.lua Blur.lua GestureRecognizer.lua Performance.lua MemoryScanner.lua" echo "utils.lua Units.lua Context.lua StateManager.lua ErrorHandler.lua Color.lua InputEvent.lua TextEditor.lua LayoutEngine.lua Renderer.lua EventHandler.lua ScrollManager.lua Element.lua RoundedRect.lua Grid.lua ModuleLoader.lua types.lua FFI.lua UTF8.lua Animation.lua NinePatch.lua ImageRenderer.lua ImageScaler.lua ImageCache.lua Theme.lua Blur.lua GestureRecognizer.lua Performance.lua MemoryScanner.lua"
;; ;;
esac esac
} }

View File

@@ -113,8 +113,9 @@ echo ""
echo -e "${YELLOW}This will:${NC}" echo -e "${YELLOW}This will:${NC}"
echo " 1. Update FlexLove.lua → flexlove._VERSION = \"${NEW_VERSION}\"" echo " 1. Update FlexLove.lua → flexlove._VERSION = \"${NEW_VERSION}\""
echo " 2. Update docs/index.html → footer version" echo " 2. Update docs/index.html → footer version"
echo " 3. Stage changes for commit" echo " 3. Create/update rockspec → flexlove-${NEW_VERSION}-1.rockspec"
echo " 4. Create git tag v${NEW_VERSION}" echo " 4. Stage changes for commit"
echo " 5. Create git tag v${NEW_VERSION}"
echo "" echo ""
read -p "Proceed? (y/n) " -n 1 -r read -p "Proceed? (y/n) " -n 1 -r
echo "" echo ""
@@ -124,12 +125,12 @@ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
fi fi
echo "" echo ""
echo -e "${CYAN}[1/3]${NC} Updating FlexLove.lua..." echo -e "${CYAN}[1/4]${NC} Updating FlexLove.lua..."
sed -i.bak "s/flexlove\._VERSION = \".*\"/flexlove._VERSION = \"${NEW_VERSION}\"/" FlexLove.lua sed -i.bak "s/flexlove\._VERSION = \".*\"/flexlove._VERSION = \"${NEW_VERSION}\"/" FlexLove.lua
rm -f FlexLove.lua.bak rm -f FlexLove.lua.bak
echo -e "${GREEN}✓ FlexLove.lua updated${NC}" echo -e "${GREEN}✓ FlexLove.lua updated${NC}"
echo -e "${CYAN}[2/3]${NC} Updating docs/index.html..." echo -e "${CYAN}[2/4]${NC} Updating docs/index.html..."
if [ -f docs/index.html ]; then if [ -f docs/index.html ]; then
sed -i.bak -E "s/FlexLöve v[0-9]+\.[0-9]+\.[0-9]+/FlexLöve v${NEW_VERSION}/" docs/index.html sed -i.bak -E "s/FlexLöve v[0-9]+\.[0-9]+\.[0-9]+/FlexLöve v${NEW_VERSION}/" docs/index.html
rm -f docs/index.html.bak rm -f docs/index.html.bak
@@ -138,8 +139,31 @@ else
echo -e "${YELLOW}⚠ docs/index.html not found, skipping${NC}" echo -e "${YELLOW}⚠ docs/index.html not found, skipping${NC}"
fi fi
echo -e "${CYAN}[3/3]${NC} Staging changes..." echo -e "${CYAN}[3/4]${NC} Creating/updating rockspec..."
git add FlexLove.lua docs/index.html # Find the most recent rockspec to use as template
LATEST_ROCKSPEC=$(ls -1 flexlove-*.rockspec 2>/dev/null | sort -V | tail -n 1)
NEW_ROCKSPEC="flexlove-${NEW_VERSION}-1.rockspec"
if [ -n "$LATEST_ROCKSPEC" ] && [ -f "$LATEST_ROCKSPEC" ]; then
# Copy existing rockspec and update version/tag
cp "$LATEST_ROCKSPEC" "$NEW_ROCKSPEC"
# Update version line
sed -i.bak "s/^version = \".*\"/version = \"${NEW_VERSION}-1\"/" "$NEW_ROCKSPEC"
# Update tag line
sed -i.bak "s/tag = \"v.*\"/tag = \"v${NEW_VERSION}\"/" "$NEW_ROCKSPEC"
rm -f "${NEW_ROCKSPEC}.bak"
echo -e "${GREEN}✓ Created ${NEW_ROCKSPEC} from ${LATEST_ROCKSPEC}${NC}"
else
echo -e "${YELLOW}⚠ No existing rockspec found, skipping rockspec creation${NC}"
echo -e "${YELLOW} You can manually create one later or run this script again${NC}"
fi
echo -e "${CYAN}[4/4]${NC} Staging changes..."
if [ -f "$NEW_ROCKSPEC" ]; then
git add FlexLove.lua docs/index.html "$NEW_ROCKSPEC"
else
git add FlexLove.lua docs/index.html
fi
echo -e "${GREEN}✓ Changes staged${NC}" echo -e "${GREEN}✓ Changes staged${NC}"
echo "" echo ""
@@ -158,7 +182,11 @@ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "You can:" echo "You can:"
echo " - Review changes: git diff --cached" echo " - Review changes: git diff --cached"
echo " - Commit manually: git commit -m 'v${NEW_VERSION} release'" echo " - Commit manually: git commit -m 'v${NEW_VERSION} release'"
echo " - Unstage: git restore --staged FlexLove.lua docs/index.html" if [ -f "$NEW_ROCKSPEC" ]; then
echo " - Unstage: git restore --staged FlexLove.lua docs/index.html ${NEW_ROCKSPEC}"
else
echo " - Unstage: git restore --staged FlexLove.lua docs/index.html"
fi
exit 0 exit 0
fi fi
@@ -186,13 +214,17 @@ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "You can:" echo "You can:"
echo " - Review changes: git diff --cached" echo " - Review changes: git diff --cached"
echo " - Commit manually: git commit -m 'v${NEW_VERSION} release'" echo " - Commit manually: git commit -m 'v${NEW_VERSION} release'"
echo " - Unstage: git restore --staged FlexLove.lua docs/index.html" if [ -f "$NEW_ROCKSPEC" ]; then
echo " - Unstage: git restore --staged FlexLove.lua docs/index.html ${NEW_ROCKSPEC}"
else
echo " - Unstage: git restore --staged FlexLove.lua docs/index.html"
fi
exit 0 exit 0
fi fi
# Commit changes # Commit changes
echo "" echo ""
echo -e "${CYAN}[4/4]${NC} Committing and tagging..." echo -e "${CYAN}[5/5]${NC} Committing and tagging..."
git commit -m "$COMMIT_MSG" git commit -m "$COMMIT_MSG"
git tag -a "v${NEW_VERSION}" -m "Release version ${NEW_VERSION}" git tag -a "v${NEW_VERSION}" -m "Release version ${NEW_VERSION}"
@@ -254,7 +286,20 @@ echo -e "${GREEN}═════════════════════
echo "" echo ""
echo -e "${CYAN}Version:${NC} ${CURRENT_VERSION}${GREEN}${NEW_VERSION}${NC}" echo -e "${CYAN}Version:${NC} ${CURRENT_VERSION}${GREEN}${NEW_VERSION}${NC}"
echo -e "${CYAN}Tag created:${NC} ${GREEN}v${NEW_VERSION}${NC}" echo -e "${CYAN}Tag created:${NC} ${GREEN}v${NEW_VERSION}${NC}"
if [ -f "$NEW_ROCKSPEC" ]; then
echo -e "${CYAN}Rockspec:${NC} ${GREEN}${NEW_ROCKSPEC}${NC}"
fi
echo "" echo ""
echo -e "${BLUE}Release will be available at:${NC}" echo -e "${BLUE}Release will be available at:${NC}"
echo " https://github.com/$(git remote get-url origin | sed 's/.*github.com[:/]\(.*\)\.git/\1/')/releases/tag/v${NEW_VERSION}" echo " https://github.com/$(git remote get-url origin | sed 's/.*github.com[:/]\(.*\)\.git/\1/')/releases/tag/v${NEW_VERSION}"
echo "" echo ""
if [ -f "$NEW_ROCKSPEC" ]; then
echo -e "${BLUE}Next steps for LuaRocks publishing:${NC}"
echo " 1. Wait for GitHub Actions to complete"
echo " 2. Upload to LuaRocks:"
echo " ${CYAN}luarocks upload ${NEW_ROCKSPEC}${NC}"
echo ""
echo -e "${YELLOW}Note: Ensure you have your LuaRocks API key configured${NC}"
echo " ${CYAN}luarocks config api-key YOUR_API_KEY${NC}"
echo ""
fi