2abf1275af8c2ac84377bae5970ce21adfa1c99c
[releng.git] / jjb / opnfvdocs / build-docu.sh
1 #!/bin/bash
2 project="opnfvdocs"
3 export PATH=$PATH:/usr/local/bin/
4
5 files=()
6 while read -r -d ''; do
7       files+=("$REPLY")
8 done < <(find . -type f -iname '*.rst' -print0)
9
10 for file in "${{files[@]}}"; do
11
12   file_cut="${{file%.*}}"
13   gs_cp_folder="${{file_cut}}"
14
15     echo "rst2html $file"
16     rst2html $file | gsutil cp -L gsoutput.txt - \
17     gs://artifacts.opnfv.org/"$project"/"$gs_cp_folder".html
18     gsutil setmeta -h "Content-Type:text/html" \
19                    -h "Cache-Control:private, max-age=0, no-transform" \
20                    gs://artifacts.opnfv.org/"$project"/"$gs_cp_folder".html
21     cat gsoutput.txt
22
23     echo "rst2pdf $file"
24     rst2pdf "$file" -o - | gsutil cp -L gsoutput.txt - \
25     gs://artifacts.opnfv.org/"$project"/"$gs_cp_folder".html
26     gsutil setmeta -h "Content-Type:application/pdf" \
27                    -h "Cache-Control:private, max-age=0, no-transform" \
28                    gs://artifacts.opnfv.org/"$project"/"$gs_cp_folder".pdf
29     cat gsoutput.txt
30
31 done
32
33 rm -f gsoutput.txt