feat: bring up generator & deployer

This commit is contained in:
SukkaW 2018-08-20 10:24:46 +08:00
parent c9b66c9394
commit dabf13058a
2 changed files with 33 additions and 0 deletions

13
util/deployer.sh Normal file
View file

@ -0,0 +1,13 @@
mkdir ./_deploy
cd ./_deploy
git init
git config --global push.default matching
git config --global user.email "${GitHubEMail}"
git config --global user.name "${GitHubUser}"
git remote add origin https://${GitHubKEY}@github.com/${GitHubRepo}.git
git pull origin gh-pages
rm -rf ./*
cp -rf ../public/* ../_deploy/
git add --all .
git commit -m "Daily check of Chrome offline packages by Travis CI"
git push --quiet --force origin HEAD:gh-pages

33
util/generator.sh Normal file
View file

@ -0,0 +1,33 @@
echo ''
echo '-------------------------------------'
echo 'Start Generator ......'
echo '-------------------------------------'
for i in $@
do
cache="http://101.96.10.72/"
version=$(sed -n '1p' ./tmp/parse/${i}-result.info)
dl_base=$(sed -n '2p' ./tmp/parse/${i}-result.info)
dl_alt_base=$(sed -n '3p' ./tmp/parse/${i}-result.info)
dl_file=$(sed -n '4p' ./tmp/parse/${i}-result.info)
dl="https://"${dl_base}${dl_file}
dl_alt="https://"${dl_alt_base}${dl_file}
dl_cache=${cache}${dl_alt_base}${dl_file}
sha256=$(sed -n '5p' ./tmp/parse/${i}-result.info)
size_raw=$(sed -n '6p' ./tmp/parse/${i}-result.info)
size=$(awk 'BEGIN{printf "%.3f",('$size_raw'/'1048576')}')" MB"
sed -i "s|{{${i}-Version}}|$version|g" tmp/index.html
sed -i "s|{{${i}-SHA256}}|$sha256|g" tmp/index.html
sed -i "s|{{${i}-dl-main}}|$dl|g" tmp/index.html
sed -i "s|{{${i}-dl-alternative}}|$dl_alt|g" tmp/index.html
sed -i "s|{{${i}-dl-cache}}|$dl_cache|g" tmp/index.html
sed -i "s|{{${i}-Size}}|$size|g" tmp/index.html
sed -i "s|{{${i}-Version}}|$version|g" tmp/chrome.xml
sed -i "s|{{${i}-SHA256}}|$sha256|g" tmp/chrome.xml
sed -i "s|{{${i}-dl-main}}|$dl|g" tmp/chrome.xml
sed -i "s|{{${i}-dl-alternative}}|$dl_alt|g" tmp/chrome.xml
sed -i "s|{{${i}-dl-cache}}|$dl_cache|g" tmp/chrome.xml
sed -i "s|{{${i}-Size}}|$size|g" tmp/chrome.xml
done