Skip to content

Commit

Permalink
Update build.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronBrennan1 authored Sep 10, 2024
1 parent 03d4be5 commit aeb8fc5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,26 @@ FILE_PATH=$2

echo "Starting script execution..."

# Convert mlx to html using MATLAB command
# Convert mlx to html and pdf using MATLAB command
# Note: Ensure that MATLAB is installed and added to the PATH
echo "Converting .mlx file to .html..."
echo "Converting .mlx file to .html and .pdf..."
ABSOLUTE_FILE_PATH=$(realpath "$FILE_PATH")
HTML_FILE_PATH=$(echo "$ABSOLUTE_FILE_PATH" | sed 's/.mlx/.html/g')
PDF_FILE_PATH=$(echo "$ABSOLUTE_FILE_PATH" | sed 's/.mlx/.pdf/g')
echo "Absolute file path: $ABSOLUTE_FILE_PATH"
echo "HTML file path: $HTML_FILE_PATH"
echo "PDF file path: $PDF_FILE_PATH"

# Setup virtual frame buffer
export DISPLAY=:100
echo "Starting virtual frame buffer..."
Xvfb -ac :100 -screen 0 1280x1024x24 > /dev/null &

# Run MATLAB command to convert .mlx to .html
# Run MATLAB command to convert .mlx to .html and .pdf
echo "Running MATLAB conversion command..."
/usr/local/MATLAB/R2024a/bin/matlab -batch "matlab.internal.liveeditor.openAndConvert('$ABSOLUTE_FILE_PATH', '$HTML_FILE_PATH')"
echo "Converting to PDF..."
/usr/local/MATLAB/R2024a/bin/matlab -batch "matlab.internal.liveeditor.openAndConvert('$ABSOLUTE_FILE_PATH', '$PDF_FILE_PATH')"

# Clone the destination repository
echo "Cloning the destination repository: https://github.com/$DEST_REPO.git"
Expand Down Expand Up @@ -50,9 +54,10 @@ TARGET_DIR="stable/tutorials/$(dirname "$FILE_PATH")"
echo "Creating the target directory: $TARGET_DIR"
mkdir -p "$TARGET_DIR"

# Copy the HTML and .mlx files to the target directory in the destination repository
echo "Copying the HTML and .mlx files to the target directory..."
# Copy the HTML, PDF, and .mlx files to the target directory in the destination repository
echo "Copying the HTML, PDF, and .mlx files to the target directory..."
cp "$HTML_FILE_PATH" "$TARGET_DIR/"
cp "$PDF_FILE_PATH" "$TARGET_DIR/"
cp "$ABSOLUTE_FILE_PATH" "$TARGET_DIR/"

# Add, commit, and push the changes
Expand Down

0 comments on commit aeb8fc5

Please sign in to comment.