Test
This commit is contained in:
61
.github/workflows/minify.yml
vendored
61
.github/workflows/minify.yml
vendored
@@ -23,48 +23,51 @@ jobs:
|
|||||||
- name: Set up Node.js
|
- name: Set up Node.js
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: '14'
|
node-version: '16'
|
||||||
|
|
||||||
- name: Install Lua minifier
|
- name: Install Lua minifier
|
||||||
run: npm install -g luamin
|
run: |
|
||||||
|
npm install luamin
|
||||||
|
echo "Testing luamin installation:"
|
||||||
|
npx luamin --version || echo "luamin version check failed"
|
||||||
|
|
||||||
- name: Combine and Minify Lua files
|
- name: Combine and Minify Lua files
|
||||||
run: |
|
run: |
|
||||||
|
set -x # Enable debug output
|
||||||
|
|
||||||
echo "Creating release directory"
|
echo "Creating release directory"
|
||||||
mkdir -p release
|
mkdir -p release
|
||||||
echo "Creating project.lua file"
|
|
||||||
echo "local project = {}" > release/project.lua
|
|
||||||
for file in $(find src -name '*.lua'); do
|
|
||||||
echo "Adding $file to project.lua"
|
|
||||||
cat $file >> release/project.lua
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Verifying project.lua"
|
echo "Creating and populating project.lua"
|
||||||
if [ -f release/project.lua ]; then
|
{
|
||||||
echo "project.lua exists"
|
echo "local project = {}"
|
||||||
|
find src -name '*.lua' -exec cat {} \;
|
||||||
|
} > release/project.lua
|
||||||
|
|
||||||
|
echo "Content of project.lua:"
|
||||||
|
cat release/project.lua
|
||||||
|
|
||||||
|
echo "Attempting minification..."
|
||||||
|
if npx luamin -f release/project.lua > release/project.min.lua; then
|
||||||
|
echo "Minification successful"
|
||||||
|
echo "Minified content size: $(wc -c < release/project.min.lua) bytes"
|
||||||
else
|
else
|
||||||
echo "Error: release/project.lua not found"
|
echo "Minification failed"
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Minifying project.lua"
|
|
||||||
minified_content=$(luamin -c "$(cat release/project.lua)")
|
|
||||||
echo "$minified_content" > release/project.min.lua
|
|
||||||
|
|
||||||
echo "Verifying project.min.lua"
|
|
||||||
if [ -f release/project.min.lua ]; then
|
|
||||||
echo "project.min.lua exists"
|
|
||||||
else
|
|
||||||
echo "Error: release/project.min.lua not found"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Commit minified Lua file
|
- name: Commit minified Lua file
|
||||||
|
if: success()
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name 'github-actions[bot]'
|
if [ -s release/project.min.lua ]; then
|
||||||
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
git config --global user.name 'github-actions[bot]'
|
||||||
git add release/project.min.lua
|
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
||||||
git commit -m 'Minify Lua files into a single project.min.lua'
|
git add release/project.min.lua
|
||||||
git push
|
git commit -m 'Minify Lua files into a single project.min.lua'
|
||||||
|
git push
|
||||||
|
else
|
||||||
|
echo "Error: project.min.lua is empty or doesn't exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -112,6 +112,5 @@ function basalt.run(isActive)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
basalt.autoUpdate = basalt.run
|
|
||||||
|
|
||||||
return basalt
|
return basalt
|
||||||
Reference in New Issue
Block a user