initial
Some checks failed
Build and Test / build-and-test (macos-latest) (push) Has been cancelled
Build and Test / build-and-test (ubuntu-latest) (push) Has been cancelled
Build and Test / build-and-test (windows-latest) (push) Has been cancelled
Build and Test / publish-tag (push) Has been cancelled
Docker build & push image / build (push) Has been cancelled
Some checks failed
Build and Test / build-and-test (macos-latest) (push) Has been cancelled
Build and Test / build-and-test (ubuntu-latest) (push) Has been cancelled
Build and Test / build-and-test (windows-latest) (push) Has been cancelled
Build and Test / publish-tag (push) Has been cancelled
Docker build & push image / build (push) Has been cancelled
This commit is contained in:
46
deploy.sh
Executable file
46
deploy.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
# Define the directory to search in
|
||||
BUILD_DIR="$HOME/quartz/"
|
||||
CONTENT_DIR="$HOME/quartz/content"
|
||||
|
||||
# Find all .md files in the directory and remove all instances of `Blog/` to fix pathing
|
||||
# Needed since all my articles are in the /Blog folder and it's subolfers in Obsidian instread of the base directory
|
||||
find "$CONTENT_DIR" -type f -name "*.md" -print0 | while IFS= read -r -d $'\0' file; do
|
||||
# Replace 'Blog/' with nothing in each file
|
||||
sed -i 's|Blog/||g' "$file"
|
||||
echo "Processed: $file"
|
||||
done
|
||||
|
||||
|
||||
|
||||
# Find all markdown files in the content directory
|
||||
find "$CONTENT_DIR" -name "*.md" -type f | while read -r file; do
|
||||
echo "Processing: $file"
|
||||
|
||||
# Check if the file contains the Private section
|
||||
if grep -q "^# Private$" "$file"; then
|
||||
# Create a temporary file for processing
|
||||
temp_file=$(mktemp)
|
||||
|
||||
# Use sed to remove content between # Private and # /Private inclusive
|
||||
sed '/^# Private$/,/^# \/Private$/d' "$file" > "$temp_file"
|
||||
|
||||
# Replace original file with processed content
|
||||
mv "$temp_file" "$file"
|
||||
|
||||
echo "Removed Private section from: $file"
|
||||
else
|
||||
echo "No Private section found in: $file"
|
||||
fi
|
||||
done
|
||||
|
||||
# echo "Processing complete!"
|
||||
echo "All .md files have been processed."
|
||||
|
||||
cd "${BUILD_DIR}"
|
||||
|
||||
# build the html files
|
||||
npx quartz build
|
||||
|
||||
# copy the files to the apache serve directory using a script
|
||||
sudo /usr/local/bin/sync-quartz-site
|
||||
Reference in New Issue
Block a user