.deployGH.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/bash
  2. #
  3. # This script is run by travis-ci and pushes generated
  4. # Doxygen docs and single-source distributions to open62541-www
  5. #
  6. TAGSTOSAVE=50
  7. #current tag info
  8. TAG="$(git rev-parse --short=10 HEAD)"
  9. BRANCH="$(git log --pretty=format:"%d" --date=iso --abbrev=10 --all -1)"
  10. DATE="$(git log --pretty=format:"%ad" --date=iso --abbrev=10 --all -1)"
  11. COMMENT="$(git log --pretty=format:"%s" --date=iso --abbrev=10 --all -1)"
  12. git fetch origin coverity_scan
  13. git clone --depth=5 -b gh-pages https://$GITAUTH@github.com/acplt/open62541-www
  14. cd open62541-www
  15. #hanndle releases
  16. cd releases
  17. if [ ! -e "$TAG.zip" ]; then
  18. #add the first line
  19. echo "<tr><td><a href='./$TAG.zip'>$TAG</a></td><td>$BRANCH</td><td>$DATE</td><td>$COMMENT</td></tr>" | cat - rawtable.txt > temp && mv temp rawtable.txt
  20. #keep top lines only
  21. head "-$TAGSTOSAVE" rawtable.txt > temp && mv temp rawtable.txt
  22. #compose the index file
  23. cat head.txt rawtable.txt foot.txt > index.html
  24. #create a zip for single-file release and copy the files
  25. cp ../../open62541.c .
  26. cp ../../open62541.h .
  27. zip -r "$TAG.zip" open62541.c open62541.h
  28. rm open62541.c
  29. rm open62541.h
  30. git add "$TAG.zip"
  31. echo "$TAG.zip" | cat - raw.txt > temp && mv temp raw.txt
  32. LINETOSTART=$((TAGSTOSAVE+1))
  33. #remove obsolete zips
  34. tail -n +"$LINETOSTART" raw.txt | xargs git rm
  35. #remove obsolete zips from list
  36. head "-$TAGSTOSAVE" raw.txt > temp && mv temp raw.txt
  37. fi
  38. cd ..
  39. #handle doc
  40. git rm -r -f doc
  41. cp -r ../doc ./
  42. git add -A doc/*
  43. git config --global user.email "open62541-travis-ci@users.noreply.github.com"
  44. git config --global user.name "Open62541 travis-ci"
  45. git config --global push.default simple
  46. git commit -am "gh-pages updated by travis-ci"
  47. git push https://$GITAUTH@github.com/acplt/open62541-www
  48. cd ..
  49. rm -rf open62541-www