56 lines
1.3 KiB
YAML
56 lines
1.3 KiB
YAML
name: Minify all Lua files to minified branch
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
minify:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Checkout main branch
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: main
|
|
fetch-depth: 0
|
|
|
|
- name: Get latest commit info
|
|
id: commit
|
|
run: |
|
|
COMMIT_MSG=$(git log -1 --pretty=%s)
|
|
echo "message=${COMMIT_MSG}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
|
|
- name: Install luamin
|
|
run: npm install -g lua-format
|
|
|
|
- name: Switch to minified branch
|
|
run: git checkout minified
|
|
|
|
- name: Copy files from main
|
|
run: |
|
|
git checkout main -- .
|
|
git reset HEAD
|
|
|
|
- name: Minify all Lua files
|
|
run: |
|
|
for file in $(find . -name "*.lua" -not -path "./.git/*"); do
|
|
echo $file
|
|
node minify.js $file
|
|
done
|
|
|
|
- name: Commit and push to minified branch
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
git add -A
|
|
git commit -m "${{ steps.commit.outputs.message }} (minified)"
|
|
git push origin minified
|