Update ci.yml #10
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] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| with: | |
| submodules: true | |
| persist-credentials: true # Ensures credentials are available for pushing changes | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: '20' | |
| - name: Install pnpm | |
| run: npm install -g pnpm | |
| - name: Install and build plugins | |
| run: | | |
| mkdir -p dist/plugins | |
| cd plugins | |
| for d in */ ; do | |
| echo "Processing plugin: $d" | |
| cd "$d" || { echo "Failed to access $d, skipping"; continue; } | |
| pnpm install || { echo "Failed to install dependencies for $d, skipping"; cd ..; continue; } | |
| pnpm run build || { echo "Failed to build $d, skipping"; cd ..; continue; } | |
| mkdir -p ../../dist/plugins/"$d" | |
| mv .millennium ../../dist/plugins/"$d".millennium || echo "Failed to move $d to dist/plugins" | |
| mv plugin.json ../../dist/plugins/"$d"plugin.json || echo "Failed to move plugin.json to dist/plugins" | |
| mv requirements.txt ../../dist/plugins/"$d"requirements.txt || echo "Failed to move requirements.txt to dist/plugins" | |
| mv README.md ../../dist/plugins/"$d"README.md || echo "Failed to move README.md to dist/plugins" | |
| mv README ../../dist/plugins/"$d"README || echo "Failed to move README to dist/plugins" | |
| # Get the backend folder from plugin.json and move it to dist/plugins | |
| backend=$(jq -r '.backend' plugin.json) | |
| if [ "$backend" != "null" ]; then | |
| mv "$backend" ../../dist/plugins/"$d""$backend" || echo "Failed to move $backend to dist/plugins" | |
| fi | |
| # Get extra files from include list in plugin.json and move them to dist/plugins | |
| include=$(jq -r '.include' plugin.json) | |
| if [ "$include" != "null" ]; then | |
| for file in $include; do | |
| mv "$file" ../../dist/plugins/"$d""$file" || echo "Failed to move $file to dist/plugins" | |
| done | |
| fi | |
| cd .. | |
| done | |
| - name: Commit and push changes | |
| run: | | |
| git config --global user.name "GitHub Actions" | |
| git config --global user.email "[email protected]" | |
| cd dist | |
| git add . | |
| git commit -m "Update built plugins" | |
| git push origin HEAD || echo "No changes to push" |