Files
Halyde/.github/workflows/minify.yml
T

58 lines
1.4 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
with:
node-version: 25.6.1
- name: Switch to minified branch
run: git checkout minified
- name: Copy files from main
run: |
git checkout main -- .
git reset HEAD
- name: Just do the whole damn thing
run: |
cd .github/workflows
npm install lua-format
for file in $(find ../.. -name "*.lua" -not -path "../../.git/*"); do
echo $file
node minify.js $file
done
cd ../..
- 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