executable_blog 938 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env bash
  2. blog_output()
  3. {
  4. echo "$(guix build --without-tests=python-orgformat --no-offload --file="$HOME"/.local/share/chezmoi/dotfiles/blog/wugi.info.scm)/share/doc/wugi.info"
  5. }
  6. case "$1" in
  7. build)
  8. (
  9. set -ex
  10. cd "$(blog_output)" || exit 1
  11. python3 -m http.server 9001
  12. echo http://blog.wugi.info/ is servered by NGINX
  13. )
  14. ;;
  15. deploy)
  16. cmd="rsync --archive --verbose "$(blog_output)/" "$HOME/src/blog-wugi-info/public""
  17. echo "Will invoke: $cmd"
  18. read -p "OK? " -n 1 -r
  19. if [[ $REPLY =~ ^[Yy]$ ]]
  20. then
  21. $cmd
  22. fi
  23. git -C "$HOME/src/blog-wugi-info/" add -A
  24. git -C "$HOME/src/blog-wugi-info/" commit -m 'Update.'
  25. read -p "Push to remote? " -n 1 -r
  26. if [[ $REPLY =~ ^[Yy]$ ]]
  27. then
  28. git -C "$HOME/src/blog-wugi-info/" push
  29. fi
  30. ;;
  31. esac