Skip to content

build: more automated, modular shared libs #32

build: more automated, modular shared libs

build: more automated, modular shared libs #32

Workflow file for this run

name: Build preview shared lib plugins
on: [ push, pull_request ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Clone actions/upload-artifact repo
run: git clone https://github.com/actions/upload-artifact.git
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'zulu'
- name: Build and upload plugins dynamically
env:
INPUT_OVERWRITE: false
INPUT_INCLUDE-HIDDEN-FILES: false
run: |
chmod +x ./gradlew
mkdir -p plugin/build/libs
for dir in plugin/*/; do
if [ -d "$dir" ]; then
dir_name=$(basename "$dir")
if [ "$dir_name" == "build" ]; then
continue
fi
echo "Building $dir_name"
./gradlew :plugin:"$dir_name":shadowJar
output_dir="plugin/$dir_name/build/libs"
jar_file=$(ls $output_dir/*.jar | grep -E ".*-all\.jar$")
if [ -z "$jar_file" ]; then
echo "No JAR file found in $output_dir for $dir_name"
exit 1
fi
base_name=$(basename "$jar_file" -all.jar)
new_name="plugin/build/libs/kotlinx-${base_name}-${GITHUB_SHA}.jar"
mv "$jar_file" "$new_name"
echo "Uploading artifact $new_name"
artifact_name="${base_name}-${GITHUB_SHA}"
INPUT_NAME="$artifact_name" INPUT_PATH="$new_name" node upload-artifact/dist/upload/index.js
fi
done