|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# List of folder paths to iterate through make sure there is no trailing slash |
| 4 | +folders=( |
| 5 | + "examples/3d/pointCloudExample" |
| 6 | +# "examples/3d/3DPrimitivesExample" |
| 7 | +# "examples/3d/ofxAssimpBoneControlExample" |
| 8 | +# "examples/3d/ofxAssimpAdvancedExample" |
| 9 | + # "examples/3d/ofxAssimpAdvancedExample" |
| 10 | + # Add more paths as needed |
| 11 | +) |
| 12 | + |
| 13 | +echo "RUNNING IN CI ${GH_BRANCH} ${GH_ACTIONS}" |
| 14 | +echo "TRYING USER/SERVER ${GA_EXAMPLES_USER}@${GA_EXAMPLES_SERVER}" |
| 15 | + |
| 16 | +cur_root=$(pwd); |
| 17 | +cd $cur_root; |
| 18 | +mkdir -p out |
| 19 | +out_folder="$cur_root/out" |
| 20 | + |
| 21 | +# Iterate through the folder paths |
| 22 | +for folder in "${folders[@]}"; do |
| 23 | + # Check if the folder exists |
| 24 | + if [ -d "$folder" ]; then |
| 25 | + |
| 26 | + # Change to the directory |
| 27 | + cd $folder |
| 28 | + cp ../../../scripts/templates/emscripten/Makefile . |
| 29 | + cp ../../../scripts/templates/emscripten/config.make . |
| 30 | + emmake make -j2 Release |
| 31 | + |
| 32 | + errorcode=$? |
| 33 | + if [[ $errorcode -ne 0 ]]; then |
| 34 | + echo "Couldn't build emscripten example: $folder" |
| 35 | + else |
| 36 | + folder_name=$(basename "$folder") |
| 37 | + cp -r "bin/em/$folder_name" "$out_folder/" |
| 38 | + fi |
| 39 | + |
| 40 | + cd $cur_root |
| 41 | + else |
| 42 | + echo "Folder does not exist: $folder" |
| 43 | + fi |
| 44 | +done |
| 45 | + |
| 46 | +cd $cur_root; |
| 47 | +DO_UPLOAD="false" |
| 48 | + |
| 49 | +#if [[ "$GH_ACTIONS" = true && "${GH_BRANCH}" == "master" && -z "${GH_HEAD_REF}" ]]; then |
| 50 | +if [[ "$GH_ACTIONS" = "true" ]]; then |
| 51 | + echo "upload 1/2 - make key file" |
| 52 | + # Temporary file to store the private key |
| 53 | + key_file=$(mktemp) |
| 54 | + echo -e "$GA_EXAMPLES_KEY" > "$key_file" |
| 55 | + chmod 600 "$key_file" |
| 56 | + DO_UPLOAD="true"; |
| 57 | +fi |
| 58 | + |
| 59 | +if [ "$DO_UPLOAD" = "true" ]; then |
| 60 | + echo "upload 2/2 - time for rsync" |
| 61 | + remote_path="/home/ofadmin/openFrameworks.cc/examples/" |
| 62 | + rsync -avz -e "ssh -i $key_file" "$out_folder/" "$GA_EXAMPLES_USER@$GA_EXAMPLES_SERVER:$remote_path" |
| 63 | + rm -f "$key_file" |
| 64 | +fi |
0 commit comments