Merge branch 'main' of https://github.com/LiliaFramework/SCPRP #149
This file contains hidden or 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: CI | |
on: [push, pull_request] | |
permissions: | |
actions: write | |
checks: write | |
contents: write | |
deployments: write | |
id-token: write | |
issues: write | |
discussions: write | |
packages: write | |
pages: write | |
pull-requests: write | |
repository-projects: write | |
security-events: write | |
statuses: write | |
jobs: | |
linter: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
name: Checkout SCPRP Repository | |
with: | |
path: scprp | |
- uses: leafo/[email protected] | |
name: Set Up Lua | |
with: | |
luaVersion: "5.2" | |
- uses: leafo/[email protected] | |
name: Set Up Luarocks | |
- uses: actions/checkout@v3 | |
name: Pull GluaCheck | |
with: | |
repository: LiliaFramework/GluaCheck | |
path: luacheck | |
- name: Build GluaCheck | |
working-directory: luacheck | |
run: luarocks make | |
- name: Run Luacheck Linting | |
working-directory: scprp | |
run: | | |
luacheck . \ | |
--no-redefined \ | |
--no-global --no-self \ | |
--no-max-line-length --no-max-code-line-length \ | |
--no-max-string-line-length --no-max-comment-line-length \ | |
--no-max-cyclomatic-complexity | |
formatter: | |
runs-on: ubuntu-latest | |
needs: linter | |
steps: | |
- uses: actions/checkout@v3 | |
name: Checkout SCPRP Repository | |
with: | |
path: scprp | |
- name: Download and Install GLuaLint | |
run: | | |
curl -L -o glualint.zip https://github.com/FPtje/GLuaFixer/releases/download/1.29.0/glualint-1.29.0-x86_64-linux.zip | |
unzip glualint.zip -d glualint_folder | |
chmod +x glualint_folder/glualint | |
sudo mv glualint_folder/glualint /usr/local/bin | |
rm -rf glualint.zip glualint_folder | |
- name: Run GLuaLint Pretty Print | |
working-directory: scprp | |
run: glualint --config glualint.json --pretty-print-files . | |
- name: Configure Git | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
- name: Commit and Push Changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.LiliaGitSecret }} | |
working-directory: scprp | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
git add . | |
git commit -m "Pretty Printed" | |
git push https://${{ secrets.LiliaGitSecret }}@github.com/${{ github.repository }}.git HEAD:main | |
else | |
echo "No changes to commit" | |
fi | |
release: | |
needs: formatter | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
name: Checkout SCPRP Repository | |
with: | |
path: scprp | |
- name: Prepare and Zip | |
run: | | |
mkdir packaged | |
cp -R scprp packaged/scprp | |
cd packaged | |
zip -r ../scprp.zip scprp | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: release | |
release_name: SCPRP | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload release asset | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: scprp.zip | |
asset_name: scprp.zip | |
asset_content_type: application/zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |