Test config Workflow
This commit is contained in:
30
.github/workflows/changelog.yml
vendored
30
.github/workflows/changelog.yml
vendored
@@ -1,30 +0,0 @@
|
|||||||
name: Generate Changelog
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- 'src/**'
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
changelog:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Generate changelog
|
|
||||||
id: changelog
|
|
||||||
uses: heinrichreimer/github-changelog-generator-action@v2.3
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Commit updated changelog
|
|
||||||
run: |
|
|
||||||
git config --local user.email "action@github.com"
|
|
||||||
git config --local user.name "GitHub Action"
|
|
||||||
git add CHANGELOG.md
|
|
||||||
git commit -m "Update changelog" || true
|
|
||||||
git push
|
|
||||||
47
.github/workflows/docs.yml
vendored
47
.github/workflows/docs.yml
vendored
@@ -1,47 +0,0 @@
|
|||||||
name: Build Docs
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- 'src/**'
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- 'src/**'
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build docs
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Setup Lua
|
|
||||||
uses: leafo/gh-actions-lua@v8
|
|
||||||
with:
|
|
||||||
luaVersion: 5.4
|
|
||||||
- name: Checkout existing docs
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
ref: gh-pages
|
|
||||||
path: build_docs
|
|
||||||
- name: Prepare references directory
|
|
||||||
run: |
|
|
||||||
mkdir -p build_docs/docs
|
|
||||||
rm -rf build_docs/docs/references
|
|
||||||
mkdir -p build_docs/docs/references
|
|
||||||
- name: Process markdown files
|
|
||||||
run: |
|
|
||||||
find src -type f -name "*.lua" | while read file; do
|
|
||||||
filename=$(basename "$file")
|
|
||||||
if [ "$filename" != "LuaLS.lua" ]; then
|
|
||||||
lua tools/markdown.lua "$file" "build_docs/docs/references/${filename%.lua}.md"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
- name: Deploy
|
|
||||||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
|
||||||
uses: peaceiris/actions-gh-pages@v3
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
publish_dir: ./build_docs
|
|
||||||
36
.github/workflows/lualsgen.yml
vendored
36
.github/workflows/lualsgen.yml
vendored
@@ -1,36 +0,0 @@
|
|||||||
name: Generate LuaLS Definitions
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- 'src/elements/**'
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- 'src/elements/**'
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
generate:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Setup Lua
|
|
||||||
uses: leafo/gh-actions-lua@v8
|
|
||||||
with:
|
|
||||||
luaVersion: "5.4"
|
|
||||||
|
|
||||||
- name: Generate LuaLS definitions
|
|
||||||
run: |
|
|
||||||
lua tools/annotationParser.lua src/elements src/LuaLS.lua
|
|
||||||
|
|
||||||
- name: Commit changes
|
|
||||||
if: github.event_name == 'push'
|
|
||||||
run: |
|
|
||||||
git config --local user.email "action@github.com"
|
|
||||||
git config --local user.name "GitHub Action"
|
|
||||||
git add src/LuaLS.lua
|
|
||||||
git commit -m "Update LuaLS definitions" || true
|
|
||||||
git push
|
|
||||||
58
.github/workflows/release.yml
vendored
58
.github/workflows/release.yml
vendored
@@ -1,58 +0,0 @@
|
|||||||
name: Create Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_run:
|
|
||||||
workflows: ["Minify Lua Code"]
|
|
||||||
types:
|
|
||||||
- completed
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
if: |
|
|
||||||
github.event.workflow_run.conclusion == 'success' &&
|
|
||||||
contains(github.event.workflow_run.head_commit.modified, 'version')
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Get Version
|
|
||||||
id: version
|
|
||||||
run: echo "version=$(cat version)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Check if version file changed
|
|
||||||
run: |
|
|
||||||
git fetch origin ${{ github.event.workflow_run.head_branch }}
|
|
||||||
if ! git diff --quiet origin/${{ github.event.workflow_run.head_branch }}^1 origin/${{ github.event.workflow_run.head_branch }} -- version; then
|
|
||||||
echo "Version file was changed"
|
|
||||||
else
|
|
||||||
echo "Version file was not changed"
|
|
||||||
exit 1
|
|
||||||
|
|
||||||
# Add version check
|
|
||||||
- name: Check if version exists
|
|
||||||
run: |
|
|
||||||
if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
|
|
||||||
echo "::error::Version v${{ steps.version.outputs.version }} already exists"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Generate changelog
|
|
||||||
id: changelog
|
|
||||||
uses: heinrichreimer/github-changelog-generator-action@v2.3
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Create Release
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
with:
|
|
||||||
tag_name: v${{ steps.version.outputs.version }}
|
|
||||||
body_path: CHANGELOG.md
|
|
||||||
files: |
|
|
||||||
CHANGELOG.md
|
|
||||||
release/basalt.lua
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,3 +4,4 @@ lua-ls-cc-tweaked-main
|
|||||||
test.xml
|
test.xml
|
||||||
ascii.lua
|
ascii.lua
|
||||||
tests
|
tests
|
||||||
|
workflows
|
||||||
98
installer.lua
Normal file
98
installer.lua
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
local basalt = require("basalt")
|
||||||
|
local REPO_URL = "https://raw.githubusercontent.com/Pyroxenium/Basalt2/master/src"
|
||||||
|
|
||||||
|
-- Basis-Komponenten die immer installiert werden müssen
|
||||||
|
local REQUIRED_FILES = {
|
||||||
|
"init.lua",
|
||||||
|
"render.lua",
|
||||||
|
"elementManager.lua",
|
||||||
|
"propertySystem.lua",
|
||||||
|
"elements/BaseElement.lua",
|
||||||
|
"elements/VisualElement.lua",
|
||||||
|
"elements/Container.lua",
|
||||||
|
"elements/BaseFrame.lua"
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Optionale Komponenten
|
||||||
|
local OPTIONAL_ELEMENTS = {
|
||||||
|
"Button",
|
||||||
|
"Input",
|
||||||
|
"Label",
|
||||||
|
"List",
|
||||||
|
"Menu",
|
||||||
|
"Table",
|
||||||
|
"Tree",
|
||||||
|
"Dropdown"
|
||||||
|
}
|
||||||
|
|
||||||
|
local OPTIONAL_PLUGINS = {
|
||||||
|
"animation",
|
||||||
|
"theme",
|
||||||
|
"xml",
|
||||||
|
"state"
|
||||||
|
}
|
||||||
|
|
||||||
|
local main = basalt.createFrame()
|
||||||
|
:setBackground(colors.lightGray)
|
||||||
|
|
||||||
|
-- Header
|
||||||
|
main:addLabel()
|
||||||
|
:setText("Basalt2 Installer")
|
||||||
|
:setPosition(2,2)
|
||||||
|
:setForeground(colors.black)
|
||||||
|
|
||||||
|
-- Element Selection
|
||||||
|
local elementList = main:addList()
|
||||||
|
:setPosition(2,4)
|
||||||
|
:setSize(20,8)
|
||||||
|
:setBackground(colors.white)
|
||||||
|
:setForeground(colors.black)
|
||||||
|
|
||||||
|
for _, element in ipairs(OPTIONAL_ELEMENTS) do
|
||||||
|
elementList:addItem({
|
||||||
|
text = element,
|
||||||
|
selected = true
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Plugin Selection
|
||||||
|
local pluginList = main:addList()
|
||||||
|
:setPosition(24,4)
|
||||||
|
:setSize(20,8)
|
||||||
|
:setBackground(colors.white)
|
||||||
|
:setForeground(colors.black)
|
||||||
|
|
||||||
|
for _, plugin in ipairs(OPTIONAL_PLUGINS) do
|
||||||
|
pluginList:addItem({
|
||||||
|
text = plugin,
|
||||||
|
selected = true
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Labels
|
||||||
|
main:addLabel()
|
||||||
|
:setText("Elements:")
|
||||||
|
:setPosition(2,3)
|
||||||
|
:setForeground(colors.black)
|
||||||
|
|
||||||
|
main:addLabel()
|
||||||
|
:setText("Plugins:")
|
||||||
|
:setPosition(24,3)
|
||||||
|
:setForeground(colors.black)
|
||||||
|
|
||||||
|
-- Install Button
|
||||||
|
main:addButton()
|
||||||
|
:setText("Install")
|
||||||
|
:setPosition(2,13)
|
||||||
|
:setSize(42,1)
|
||||||
|
:onClick(function()
|
||||||
|
-- Installation Logic hier
|
||||||
|
local selectedElements = {}
|
||||||
|
local selectedPlugins = {}
|
||||||
|
|
||||||
|
-- Sammle ausgewählte Items
|
||||||
|
-- Download Files
|
||||||
|
-- Erstelle Ordnerstruktur
|
||||||
|
end)
|
||||||
|
|
||||||
|
basalt.autoUpdate()
|
||||||
118
minify.yml
118
minify.yml
@@ -1,118 +0,0 @@
|
|||||||
name: Minify Lua Code
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- 'src/**'
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- 'src/**'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
minify:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Install Lua
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y lua5.3
|
|
||||||
|
|
||||||
- name: Minify Lua files
|
|
||||||
run: |
|
|
||||||
mkdir -p release
|
|
||||||
|
|
||||||
echo "Creating minification script..."
|
|
||||||
cat > minify_script.lua << 'EOL'
|
|
||||||
local minify = loadfile("tools/minify.lua")()
|
|
||||||
local lfs = require("lfs")
|
|
||||||
|
|
||||||
local files = {}
|
|
||||||
|
|
||||||
local function scanDir(dir, baseDir)
|
|
||||||
baseDir = baseDir or ""
|
|
||||||
for file in lfs.dir(dir) do
|
|
||||||
if file ~= "." and file ~= ".." then
|
|
||||||
local fullPath = dir .. "/" .. file
|
|
||||||
local attr = lfs.attributes(fullPath)
|
|
||||||
if attr.mode == "directory" then
|
|
||||||
scanDir(fullPath, baseDir .. file .. "/")
|
|
||||||
elseif file:match("%.lua$") and file ~= "LuaLS.lua" then
|
|
||||||
table.insert(files, {
|
|
||||||
path = baseDir .. file,
|
|
||||||
fullPath = fullPath
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
scanDir("src")
|
|
||||||
|
|
||||||
local output = {
|
|
||||||
'local minified = true\n',
|
|
||||||
'local project = {}\n',
|
|
||||||
'local baseRequire = require\n',
|
|
||||||
'require = function(path) return project[path] or baseRequire(path) end\n'
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, file in ipairs(files) do
|
|
||||||
local f = io.open(file.fullPath, "r")
|
|
||||||
local content = f:read("*all")
|
|
||||||
f:close()
|
|
||||||
|
|
||||||
local success, minified = minify(content)
|
|
||||||
if not success then
|
|
||||||
print("Failed to minify " .. file.path)
|
|
||||||
print(minified)
|
|
||||||
os.exit(1)
|
|
||||||
end
|
|
||||||
|
|
||||||
table.insert(output, string.format(
|
|
||||||
'project["%s"] = function(...) %s end\n',
|
|
||||||
file.path, minified
|
|
||||||
))
|
|
||||||
end
|
|
||||||
|
|
||||||
table.insert(output, 'return project["main.lua"]')
|
|
||||||
|
|
||||||
local out = io.open("release/basalt.lua", "w")
|
|
||||||
out:write(table.concat(output))
|
|
||||||
out:close()
|
|
||||||
EOL
|
|
||||||
|
|
||||||
echo "Installing LuaFileSystem..."
|
|
||||||
sudo apt-get install -y lua-filesystem
|
|
||||||
|
|
||||||
echo "Running minification..."
|
|
||||||
if lua minify_script.lua; then
|
|
||||||
echo "Minification successful"
|
|
||||||
echo "Files processed:"
|
|
||||||
find src -name "*.lua" | sed 's|^src/||'
|
|
||||||
else
|
|
||||||
echo "Minification failed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Commit minified Lua file
|
|
||||||
if: success()
|
|
||||||
run: |
|
|
||||||
if [ -s release/basalt.lua ]; then
|
|
||||||
git config --global user.name 'github-actions[bot]'
|
|
||||||
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
|
||||||
git add release/basalt.lua
|
|
||||||
git commit -m 'Minify all Lua files into project bundle'
|
|
||||||
git push
|
|
||||||
else
|
|
||||||
echo "Error: basalt.lua is empty or doesn't exist"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
27
tools/generate-config.lua
Normal file
27
tools/generate-config.lua
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
local function scanDir(dir)
|
||||||
|
local files = {}
|
||||||
|
for file in io.popen('find "'..dir..'" -type f -name "*.lua"'):lines() do
|
||||||
|
local name = file:match("([^/]+)%.lua$")
|
||||||
|
if name then
|
||||||
|
files[file] = {
|
||||||
|
name = name,
|
||||||
|
path = file:gsub("^src", ""),
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return files
|
||||||
|
end
|
||||||
|
|
||||||
|
local config = {
|
||||||
|
repo = "https://raw.githubusercontent.com/Pyroxenium/Basalt2/master",
|
||||||
|
required = {
|
||||||
|
["src/init.lua"] = "/init.lua",
|
||||||
|
["src/render.lua"] = "/render.lua",
|
||||||
|
},
|
||||||
|
elements = scanDir("src/elements"),
|
||||||
|
plugins = scanDir("src/plugins")
|
||||||
|
}
|
||||||
|
|
||||||
|
local f = io.open("config.lua", "w")
|
||||||
|
f:write("return " .. textutils.serialize(config))
|
||||||
|
f:close()
|
||||||
Reference in New Issue
Block a user