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