56 lines
1.3 KiB
YAML
56 lines
1.3 KiB
YAML
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: Set up Node.js
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '14'
|
|
|
|
- name: Install Lua minifier
|
|
run: npm install -g luamin
|
|
|
|
- name: Combine Lua files
|
|
run: |
|
|
echo "Creating release directory"
|
|
mkdir -p release
|
|
echo "Creating project.lua file"
|
|
echo "local project = {}" > release/project.lua
|
|
for file in $(find . -name '*.lua'); do
|
|
echo "Adding $file to project.lua"
|
|
cat $file >> release/project.lua
|
|
done
|
|
|
|
- name: Minify combined Lua file
|
|
run: |
|
|
echo "Minifying project.lua"
|
|
luamin -f release/project.lua -o release/project.min.lua
|
|
|
|
- name: Commit minified file
|
|
run: |
|
|
git config --global user.name 'github-actions[bot]'
|
|
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
|
git add release/project.min.lua
|
|
git commit -m 'Minify Lua files into a single project.min.lua'
|
|
git push
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|