Refactor "compiler" script #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "\"Compile\" Groovy Scripts" | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "compiled/**" | |
jobs: | |
compile: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Run Groovy Compiler | |
shell: pwsh | |
run: | | |
# Find groovy files starts with _ on current directory | |
$groovyFiles = Get-ChildItem -Path . -Filter "_*.groovy" -Recurse | |
# Compile each groovy file | |
foreach ($file in $groovyFiles) { | |
$compiledFile = "compiled/$($file.Name -replace '^_','')" | |
Write-Host "Compiling $($file.FullName) to $compiledFile" | |
python3 compiler.py $file.FullName $compiledFile | |
} | |
- name: Commit and Push Changes | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git add compiled | |
git commit -m "Compile Groovy Scripts" | |
git push |