.deployGH_release.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 clone --depth=5 -b gh-pages https://$GITAUTH@github.com/open62541/open62541-www
  13. cd open62541-www
  14. #hanndle releases
  15. cd releases
  16. if [ ! -e "$TAG.zip" ]; then
  17. #add the first line
  18. 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
  19. #keep top lines only
  20. head "-$TAGSTOSAVE" rawtable.txt > temp && mv temp rawtable.txt
  21. #compose the index file
  22. cat head.txt rawtable.txt foot.txt > index.html
  23. #create a zip for single-file release and copy the files
  24. cp ../../open62541.c .
  25. cp ../../open62541.h .
  26. zip -r "$TAG.zip" open62541.c open62541.h
  27. rm open62541.c
  28. rm open62541.h
  29. git add "$TAG.zip"
  30. echo "$TAG.zip" | cat - raw.txt > temp && mv temp raw.txt
  31. LINETOSTART=$((TAGSTOSAVE+1))
  32. #remove obsolete zips
  33. tail -n +"$LINETOSTART" raw.txt | xargs git rm
  34. #remove obsolete zips from list
  35. head "-$TAGSTOSAVE" raw.txt > temp && mv temp raw.txt
  36. fi
  37. cd ..
  38. git config --global user.email "open62541-travis-ci@users.noreply.github.com"
  39. git config --global user.name "Open62541 travis-ci"
  40. git config --global push.default simple
  41. git commit -am "added release files and updated releases webpage by travis-ci [ci skip]"
  42. git push https://$GITAUTH@github.com/open62541/open62541-www
  43. cd ..
  44. rm -rf open62541-www