255 lines
9.8 KiB
YAML
255 lines
9.8 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build-and-release:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Extract version from tag or FlexLove.lua
|
|
id: version
|
|
run: |
|
|
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
|
|
VERSION=${GITHUB_REF#refs/tags/v}
|
|
echo "Triggered by tag: $GITHUB_REF_NAME"
|
|
else
|
|
VERSION=$(grep -m 1 "_VERSION" FlexLove.lua | awk -F'"' '{print $2}')
|
|
echo "Triggered manually, using FlexLove.lua version"
|
|
fi
|
|
|
|
# Verify version was extracted
|
|
if [ -z "$VERSION" ]; then
|
|
echo "ERROR: Failed to extract version from FlexLove.lua"
|
|
echo "Looking for line matching: _VERSION"
|
|
grep "_VERSION" FlexLove.lua || echo "No _VERSION found"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Extracted version: $VERSION"
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
echo "tag=v${VERSION}" >> $GITHUB_OUTPUT
|
|
|
|
FLEX_VERSION=$(grep -m 1 "_VERSION" FlexLove.lua | awk -F'"' '{print $2}')
|
|
echo "FlexLove.lua version: $FLEX_VERSION"
|
|
echo "Release version: $VERSION"
|
|
|
|
if [ "$FLEX_VERSION" != "$VERSION" ]; then
|
|
echo "⚠️ Warning: Version mismatch detected"
|
|
echo " FlexLove.lua: $FLEX_VERSION"
|
|
echo " Release version: $VERSION"
|
|
echo " Using: $VERSION"
|
|
else
|
|
echo "✓ Version check passed"
|
|
fi
|
|
|
|
- name: Install lua-language-server
|
|
run: |
|
|
LLS_VERSION="3.7.4"
|
|
wget -q "https://github.com/LuaLS/lua-language-server/releases/download/${LLS_VERSION}/lua-language-server-${LLS_VERSION}-linux-x64.tar.gz"
|
|
mkdir -p ~/.local/bin/lua-language-server
|
|
tar -xzf "lua-language-server-${LLS_VERSION}-linux-x64.tar.gz" -C ~/.local/bin/lua-language-server
|
|
echo "$HOME/.local/bin/lua-language-server/bin" >> $GITHUB_PATH
|
|
rm "lua-language-server-${LLS_VERSION}-linux-x64.tar.gz"
|
|
|
|
- name: Verify lua-language-server installation
|
|
run: |
|
|
lua-language-server --version
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '18'
|
|
cache: 'npm'
|
|
cache-dependency-path: docs/package.json
|
|
|
|
- name: Install Node.js dependencies
|
|
working-directory: docs
|
|
run: npm ci
|
|
|
|
- name: Make scripts executable
|
|
run: |
|
|
chmod +x scripts/generate_docs.sh
|
|
chmod +x scripts/create-release.sh
|
|
chmod +x scripts/create-profile-packages.sh
|
|
chmod +x scripts/archive-docs.sh
|
|
|
|
- name: Archive previous documentation version
|
|
run: |
|
|
if [ -f "docs/api.html" ]; then
|
|
OLD_VERSION=$(grep -o 'FlexLöve v[0-9.]*' docs/api.html | head -1 | sed 's/FlexLöve v//')
|
|
if [ -n "$OLD_VERSION" ]; then
|
|
echo "Found previous version: v${OLD_VERSION}"
|
|
mkdir -p "docs/versions/v${OLD_VERSION}"
|
|
cp docs/api.html "docs/versions/v${OLD_VERSION}/api.html"
|
|
echo "✓ Archived previous documentation to docs/versions/v${OLD_VERSION}/"
|
|
else
|
|
echo "No previous version found, skipping archival"
|
|
fi
|
|
else
|
|
echo "No existing documentation to archive"
|
|
fi
|
|
|
|
- name: Generate documentation
|
|
run: |
|
|
./scripts/generate_docs.sh
|
|
# Verify api.html was created
|
|
if [ ! -f "docs/api.html" ]; then
|
|
echo "Error: docs/api.html was not generated"
|
|
exit 1
|
|
fi
|
|
echo "✓ Documentation generated successfully"
|
|
|
|
- name: Commit archived documentation
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git add docs/versions/ docs/api.html docs/doc.json docs/doc.md
|
|
git commit -m "Archive previous documentation and generate v${{ steps.version.outputs.version }} docs [skip ci]" || echo "No changes to commit"
|
|
git push origin HEAD:main || echo "Nothing to push"
|
|
|
|
- name: Create release packages
|
|
run: |
|
|
# Create all 4 profile packages
|
|
./scripts/create-profile-packages.sh
|
|
|
|
# Verify all packages were created
|
|
VERSION="${{ steps.version.outputs.version }}"
|
|
for profile in minimal slim default full; do
|
|
if [ ! -f "releases/flexlove-${profile}-v${VERSION}.zip" ]; then
|
|
echo "Error: ${profile} profile package was not created"
|
|
exit 1
|
|
fi
|
|
if [ ! -f "releases/flexlove-${profile}-v${VERSION}.zip.sha256" ]; then
|
|
echo "Error: ${profile} checksum file was not created"
|
|
exit 1
|
|
fi
|
|
done
|
|
echo "✓ All profile packages created successfully"
|
|
|
|
- name: Extract checksums for release notes
|
|
id: checksums
|
|
run: |
|
|
VERSION="${{ steps.version.outputs.version }}"
|
|
MINIMAL_CHECKSUM=$(cat "releases/flexlove-minimal-v${VERSION}.zip.sha256" | cut -d ' ' -f 1)
|
|
SLIM_CHECKSUM=$(cat "releases/flexlove-slim-v${VERSION}.zip.sha256" | cut -d ' ' -f 1)
|
|
DEFAULT_CHECKSUM=$(cat "releases/flexlove-default-v${VERSION}.zip.sha256" | cut -d ' ' -f 1)
|
|
FULL_CHECKSUM=$(cat "releases/flexlove-full-v${VERSION}.zip.sha256" | cut -d ' ' -f 1)
|
|
|
|
echo "minimal=$MINIMAL_CHECKSUM" >> $GITHUB_OUTPUT
|
|
echo "slim=$SLIM_CHECKSUM" >> $GITHUB_OUTPUT
|
|
echo "default=$DEFAULT_CHECKSUM" >> $GITHUB_OUTPUT
|
|
echo "full=$FULL_CHECKSUM" >> $GITHUB_OUTPUT
|
|
|
|
- name: Check if pre-release
|
|
id: prerelease
|
|
run: |
|
|
VERSION="${{ steps.version.outputs.version }}"
|
|
if [[ "$VERSION" =~ (alpha|beta|rc|dev) ]]; then
|
|
echo "is_prerelease=true" >> $GITHUB_OUTPUT
|
|
echo "This is a pre-release version"
|
|
else
|
|
echo "is_prerelease=false" >> $GITHUB_OUTPUT
|
|
echo "This is a stable release"
|
|
fi
|
|
|
|
- name: Generate release notes
|
|
id: release_notes
|
|
run: |
|
|
VERSION="${{ steps.version.outputs.version }}"
|
|
cat > release_notes.md << 'EOF'
|
|
## Build Profiles
|
|
|
|
FlexLöve is now available in 4 different build profiles to optimize bundle size for your needs:
|
|
|
|
| Profile | Size | Description | Package |
|
|
|---------|------|-------------|---------|
|
|
| **Minimal** | ~70% | Core functionality only | `flexlove-minimal-v${{ steps.version.outputs.version }}.zip` |
|
|
| **Slim** | ~80% | + Animation and Image support | `flexlove-slim-v${{ steps.version.outputs.version }}.zip` |
|
|
| **Default** | ~95% | + Theme and Blur effects | `flexlove-default-v${{ steps.version.outputs.version }}.zip` |
|
|
| **Full** | 100% | All modules including debugging tools | `flexlove-full-v${{ steps.version.outputs.version }}.zip` |
|
|
|
|
**Choose the profile that matches your needs!** See the [Build Profiles Documentation](https://github.com/${{ github.repository }}/blob/main/docs/BUILD_PROFILES.md) for detailed module listings.
|
|
|
|
## Installation
|
|
|
|
Download your preferred profile package and extract to your LÖVE2D project:
|
|
|
|
```bash
|
|
# Example: Install the default profile
|
|
unzip flexlove-default-v${{ steps.version.outputs.version }}.zip
|
|
cp -r flexlove/modules ./
|
|
cp flexlove/FlexLove.lua ./
|
|
```
|
|
|
|
## Verification
|
|
|
|
Verify download integrity using SHA256:
|
|
|
|
```bash
|
|
shasum -a 256 -c flexlove-<profile>-v${{ steps.version.outputs.version }}.zip.sha256
|
|
```
|
|
|
|
**SHA256 Checksums:**
|
|
```
|
|
Minimal: ${{ steps.checksums.outputs.minimal }}
|
|
Slim: ${{ steps.checksums.outputs.slim }}
|
|
Default: ${{ steps.checksums.outputs.default }}
|
|
Full: ${{ steps.checksums.outputs.full }}
|
|
```
|
|
|
|
## Documentation
|
|
|
|
📚 [View Full Documentation](https://mikefreno.github.io/FlexLove/)
|
|
|
|
## What's Included
|
|
|
|
Each package contains:
|
|
- `FlexLove.lua` - Main library file
|
|
- `modules/` - Profile-specific module files
|
|
- `LICENSE` - MIT License
|
|
- `README.md` - Profile-specific readme
|
|
|
|
## Requirements
|
|
|
|
- LÖVE2D 11.0 or higher
|
|
|
|
---
|
|
|
|
_For examples and full source code, visit the [repository](https://github.com/${{ github.repository }})._
|
|
EOF
|
|
cat release_notes.md
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
tag_name: v${{ steps.version.outputs.version }}
|
|
name: FlexLöve v${{ steps.version.outputs.version }}
|
|
body_path: release_notes.md
|
|
files: |
|
|
releases/flexlove-minimal-v${{ steps.version.outputs.version }}.zip
|
|
releases/flexlove-minimal-v${{ steps.version.outputs.version }}.zip.sha256
|
|
releases/flexlove-slim-v${{ steps.version.outputs.version }}.zip
|
|
releases/flexlove-slim-v${{ steps.version.outputs.version }}.zip.sha256
|
|
releases/flexlove-default-v${{ steps.version.outputs.version }}.zip
|
|
releases/flexlove-default-v${{ steps.version.outputs.version }}.zip.sha256
|
|
releases/flexlove-full-v${{ steps.version.outputs.version }}.zip
|
|
releases/flexlove-full-v${{ steps.version.outputs.version }}.zip.sha256
|
|
prerelease: ${{ steps.prerelease.outputs.is_prerelease }}
|
|
draft: false
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|