22
22
23
23
24
24
# some variable definitions
25
- arduinoESP_src=$PWD " /../"
25
+ tmp_path=$1
26
+ arduinoESP_src=" $tmp_path /arduino"
26
27
version=" $( git --work-tree=$arduinoESP_src describe --tags --always) "
27
28
release_date=$( date " +%b_%d,_%Y" ) # format for badge link
28
29
build_date=$( date " +%b %d, %Y" )
29
- destinaton_path= " /tmp /doc"
30
+ destination_path= " $tmp_path /doc"
30
31
doc_template_url=" https://github.com/pgollor/esp8266-arduino-docs.git"
31
32
url=" http://pgollor.github.io/Arduino"
32
33
@@ -35,7 +36,7 @@ echo "Arduino ESP8266 source dir: "$arduinoESP_src
35
36
echo " version: " $version
36
37
echo " release date: " $release_date
37
38
echo " build date: " $build_date
38
- echo " put documentation into: " $destinaton_path
39
+ echo " put documentation into: " $destination_path
39
40
echo " documentatino template url: " $doc_template_url
40
41
echo " url: " $url
41
42
50
51
51
52
52
53
# delete old doc dir
53
- rm -fR $destinaton_path
54
+ rm -fR $destination_path
54
55
55
56
# create destination directories
56
- mkdir -p $destinaton_path /src
57
- mkdir -p $destinaton_path /$version
57
+ mkdir -p $destination_path /src
58
+ mkdir -p $destination_path /$version
58
59
59
60
# copy doc files to destination soruce dir
60
- cp -R $arduinoESP_src /doc/* $destinaton_path /src
61
+ cp -R $arduinoESP_src /doc/* $destination_path /src
61
62
62
63
# download doc template
63
- git clone $doc_template_url $destinaton_path /build
64
+ git clone $doc_template_url $destination_path /build
64
65
66
+ # create versions.html file
65
67
66
- # cur_dir=$PWD
67
- # cd $destinaton_path/build
68
- pushd $destinaton_path /build
68
+ # ... read verions
69
+ pushd $arduinoESP_src
70
+ old_versions=$( git ls-tree -d --name-only remotes/origin/gh-pages versions/ | sed -e ' s/versions\///g' )
71
+ popd
72
+
73
+ echo -e " \nREAD old versions:"
74
+
75
+ found_current_version=" false"
76
+ case " ${old_versions[@]} " in * " $version " * ) found_current_version=" true" ;; esac
77
+
78
+ if [ " $found_current_version " = " false" ]; then
79
+ old_versions=$version " " $old_versions
80
+ fi
81
+
82
+ # ... fill versions.html
83
+ for VER in $old_versions
84
+ do
85
+ echo $VER
86
+ echo " <li><a href=\" versions/$VER \" >$VER </a></li>" >> $destination_path /build/_includes/versions.html
87
+ done
88
+ echo " "
89
+
90
+
91
+ # into build dir
92
+ pushd $destination_path /build
69
93
70
94
# link documentation source
71
95
ln -s ../src doc
@@ -82,9 +106,8 @@ echo "baseurl: /Arduino/versions/$version" >> _config_local.yml
82
106
jekyll build --config _config.yml,_config_local.yml
83
107
84
108
popd
85
- # cd $cur_dir
86
109
87
110
88
111
# grab badge
89
- wget -q -O $destinaton_path /$version /badge.svg " https://img.shields.io/badge/updated-$release_date -blue.svg"
112
+ wget -q -O $destination_path /$version /badge.svg " https://img.shields.io/badge/updated-$release_date -blue.svg"
90
113
0 commit comments