fix: Update builder #31
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: 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: | | |
pnpm install --save-dev semantic-release @semantic-release/changelog @semantic-release/git @semantic-release/github | |
mkdir -p dist/ | |
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/"$d" | |
cp -r .millennium ../../dist/"$d".millennium || echo "Failed to move $d to dist" | |
cp plugin.json ../../dist/"$d"plugin.json || echo "Failed to move plugin.json to dist" | |
cp requirements.txt ../../dist/"$d"requirements.txt || echo "Failed to move requirements.txt to dist" | |
cp README.md ../../dist/"$d"README.md || echo "Failed to move README.md to dist" | |
cp README ../../dist/"$d"README || echo "Failed to move README to dist" | |
# Get the backend folder from plugin.json and move it to dist | |
backend=$(jq -r '.backend' plugin.json) | |
if [ "$backend" != "null" ]; then | |
cp -r "$backend" ../../dist/"$d""$backend" || echo "Failed to move $backend to dist" | |
fi | |
# Get extra files from include list in plugin.json and move them to dist | |
include=$(jq -r '.include' plugin.json) | |
if [ "$include" != "null" ]; then | |
for file in $include; do | |
cp -r "$file" ../../dist/"$d""$file" || echo "Failed to move $file to dist" | |
done | |
fi | |
cd .. | |
done | |
- name: Zip folders in /dist | |
run: | | |
mkdir -p build | |
cd dist | |
for folder in */; do | |
out="${folder%/}" | |
# get theme name | |
theme_name=$(jq -r '.name' "$folder"plugin.json) | |
touch "$folder"metadata.json | |
# write current commit id to metadata.json | |
echo "{\"commit\": \"$(git rev-parse HEAD)\"}" > "$folder"metadata.json | |
echo "Zipping folder: $folder" | |
zip -r "$out.zip" "$folder" || echo "Failed to zip $folder" | |
mv "$out.zip" ../build/$theme_name.zip || echo "Failed to move $folder.zip to build" | |
done | |
- name: List built plugins | |
run: ls -l build/ | |
- name: Run Semantic Release | |
run: | | |
npx semantic-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |