deploy-to-ovh.fish 693 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/fish
  2. echo 'Deploy website through FTP'
  3. function require
  4. set var $argv[1]
  5. if not set -q $var
  6. echo "Please provide a value for $var"
  7. echo "Did you run the command source against your .env.local?"
  8. exit
  9. end
  10. end
  11. require FTP_HOST
  12. require FTP_USER
  13. require FTP_DEST
  14. require DIST_DIR
  15. set files (find $DIST_DIR -type f)
  16. echo 'Files to be sent :'
  17. echo "$files"
  18. echo "FTP to $FTP_HOST"
  19. read --prompt-str "[deploy] password for $FTP_USER: " --silent password
  20. echo
  21. # ftp operation
  22. set ftp_cmd "\
  23. user $FTP_USER $password
  24. nmap $DIST_DIR/\$1 $FTP_DEST/\$1
  25. mput $files
  26. bye
  27. "
  28. echo $ftp_cmd | ftp -pvin $FTP_HOST $FTP_PORT