Skip to content

Add Samehadaku....

Add Samehadaku.... #77

name: "\"Compile\" Groovy Scripts"
on:
push:
branches:
- main
paths:
- '_*.groovy'
- "compiler.py"
- ".github/workflows/they_said_to_compile.yaml"
- "modules/**"
- "post_*.groovy"
jobs:
compile:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Configure Git
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install regex
- name: Run Groovy So-Compiler for file format
run: |
create_symlink() {
local target="$1"
local link_name="$2"
rm -f "$link_name"
ln -s "$target" "$link_name"
echo "Created symlink: $target -> $link_name"
}
rm -f _posix*.groovy _windows*.groovy
groovyFiles=$(find . -type f -name "_*.groovy")
mkdir -p compiled
for file in $groovyFiles; do
fbname=$(basename "$file")
nodash="${fbname#_}"
compiledFile="compiled/$nodash"
python3 compiler.py "$file" "$compiledFile"
cpx="_posix$fbname"
cwx="_windows$fbname"
create_symlink "$fbname" "$cpx"
create_symlink "$fbname" "$cwx"
(
cd compiled || continue
create_symlink "$nodash" "${cpx#_}"
create_symlink "$nodash" "${cwx#_}"
)
done
- name: Run Groovy So-Called Compiler for post_ and preset_*.groovy files
run: |
# Find groovy files starts with post_ and preset_ on current directory
groovyFiles=$(find . -type f -name "post_*.groovy")
# Compile each groovy file
for file in $groovyFiles; do
compiledFile="compiled/$(basename "$file")"
python3 compiler.py "$file" "$compiledFile"
done
- name: Commit and Push Changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git add compiled
git commit -m "Compile Groovy Scripts"
git push