cabin-deploy.sh (1126B)
1 #!/bin/bash 2 3 # cabin-deploy.sh: generate blog files and deploy to server 4 5 # Take contents of the source and copy it to destination 6 # Turn markdown into html in the process and create indexes 7 # At the end send everything to the server 8 9 if [ "$#" -ne 2 ]; then 10 echo "Error: Invalid number of arguments" 11 echo "Usage: $0 source destination" 12 exit 1 13 fi 14 15 src="$(realpath $1)" 16 dst="$(realpath $2)" 17 18 # copy all of the files from source to desination 19 # excluding md files and .git subdirectory 20 pushd "$src" || exit 21 find . -not -iname "*.md" -a -not -path "*.git*" | cpio -pd "$dst" 2>/dev/null 22 popd || exit 23 24 opt=() 25 opt+=(--author "Dimitrije Dobrota") 26 opt+=(--base "https://dimitrijedobrota.com") 27 opt+=(--email "mail@dimitrijedobrota.com") 28 opt+=(--desc "Contents of Dimitrije Dobrota's blog") 29 opt+=(--summary "Click on the article link to read...") 30 31 # Convert all the md files to articles 32 # Create all the indexes 33 stamd "${opt[@]}" --output "$dst/blog" --index $src/blog/*.md 34 35 # Create a home page 36 stamd "${opt[@]}" --output "$dst" $src/*.md 37 38 # Copy everything to the server 39 rsync -a $dst/* server:/var/www/cabin