version: '3' # # You can override the host variable by passing it as a command line parameter. # task upload -- UPLOAD_TARGET: "localvm" # vars: UPLOAD_TARGET: # UPLOAD_TARGET: "remotevps" # UPLOAD_TARGET: "localvm" tasks: default: desc: whole workflow cmds: - task: copy - task: obsidian_convert # - task: deadlinks - task: mkdocs # **CAREFULL** be sur you deploy on the right upload target - task: upload copy: desc: copies the folder without the hidden files (and filter on a YAML frontmatter attribute) cmds: - cp ../ders/mkdocs.yml . - ./bin/copy_folder.py ../ders/ders tmp0 # # filter the exercices # - ./bin/filter_md_files.py --source tmp0 --destination tmp --filter-key kind --filter-value exercice # - rm -rf tmp0 - mv tmp0 tmp obsidian_convert: desc: converts obsidian wiki syntax into a standard markdown cmds: - ./bin/obsidian_converter.py tmp/ docs - rm -rf tmp generates: - docs # deadlinks: # desc: remove dead links # cmds: # - ./bin/md_link_cleaner.py --source tmp2 --destination docs # - rm -rf tmp2 # generates: # - docs mkdocs: desc: mkdocs html generation cmds: - ./.venv/bin/mkdocs build generates: - site upload: desc: uploads the generated html cmds: - | if [ "{{.UPLOAD_TARGET}}" = "remotevps" ]; then echo "deployment in remote VPS" rsync -avH -e "ssh -i ./hosts/XXXXX.key" --force --stats ./site/* root@monvps.fr:/var/www/html/ elif [ "{{.UPLOAD_TARGET}}" = "localvm" ]; then echo "deployment in the local VM" rsync -avH -e "ssh -i ./hosts/localvm/toto_key" --force --stats ./site/* ubuntu@toto.local:/var/www/html/ else echo "Unknown deployment target: {{.UPLOAD_TARGET}}" exit 1 fi - task: clean clean: desc: suppression of all data cmds: # generated files and folders - rm -rf docs - rm -rf site