Skip to content

Update README: Remove post_groovy instruct, update examples and guide #55

Update README: Remove post_groovy instruct, update examples and guide

Update README: Remove post_groovy instruct, update examples and guide #55

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: |
# Find groovy files starts with _ on current directory
groovyFiles=$(find . -type f -name "_*.groovy")
# Compile each groovy file
for file in $groovyFiles; do
compiledFile="compiled/$(basename "$file" | sed 's/^_//')"
python3 compiler.py "$file" "$compiledFile"
ln -s "$compiledFile" "compiled/posix_$compiledFile"
ln -s "$compiledFile" "compiled/windows_$compiledFile"
done
- name: Link old files
run: |
# link compiled/{}.groovy to compiled/posix_{}.groovy and compiled/windows_{}.groovy
for file in $(find compiled -type f -name "*.groovy"); do
fbname=$(basename "$file")
ln -s "$fbname" "compiled/posix_$fbname"
ln -s "$fbname" "compiled/windows_$fbname"
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