makeRelease.sh 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #!/bin/bash
  2. cd "`dirname "$0"`"
  3. # Read version number
  4. eval `awk '/Vc_VERSION_NUMBER 0x[0-9]+/ { h=$3 }
  5. END {
  6. major=strtonum(substr(h, 1, 4))
  7. minor=strtonum("0x" substr(h, 5, 2))
  8. patch=strtonum("0x" substr(h, 7, 2)) / 2
  9. printf "oldVersion=\"%d.%d.%d\"\n", major, minor, patch
  10. printf "newVersion=\"%d.%d.%d\"\n", major, minor, patch + 1
  11. }' Vc/version.h`
  12. echo "current version: $oldVersion"
  13. echo -n " new release: "
  14. read -e -i "$newVersion" newVersion
  15. versionString=$newVersion
  16. versionNumber=`echo $newVersion | awk '{ split($0, v, "."); printf "0x%02x%02x%02x", v[1], v[2], v[3] * 2 }'`
  17. # Update the version number
  18. sed -i \
  19. -e "s/^PROJECT_NUMBER = .*\$/PROJECT_NUMBER = $versionString/" \
  20. -e "s/^HTML_TIMESTAMP = YES/HTML_TIMESTAMP = NO/" \
  21. doc/Doxyfile
  22. sed -i \
  23. -e "s/Vc_VERSION_STRING \".*\"\$/Vc_VERSION_STRING \"$versionString\"/" \
  24. -e "s/Vc_VERSION_NUMBER 0x.*\$/Vc_VERSION_NUMBER $versionNumber/" \
  25. Vc/version.h
  26. cat Vc/version.h
  27. # Modify README.md to link to release docs
  28. ed README.md <<EOF
  29. P
  30. /github.io/a
  31. * [$versionString release](https://vcdevel.github.io/Vc-$versionString/)
  32. .
  33. w
  34. EOF
  35. # Don't build tests with make all
  36. sed -i -e 's/#Release# //' CMakeLists.txt
  37. git commit README.md CMakeLists.txt doc/Doxyfile Vc/version.h -s -F- <<EOF
  38. release: version $versionString
  39. * change version strings/numbers to $versionString
  40. * disable HTML_TIMESTAMP for doxygen
  41. * don't build tests with make all
  42. * Add documentation link to Vc-$versionString
  43. EOF
  44. git tag -m "Vc $versionString release" -s "$versionString" || exit
  45. # Create tarball
  46. git archive --format=tar --prefix="Vc-$versionString/" "$versionString" | gzip > ../"Vc-$versionString.tar.gz"
  47. # Create API docs tarball
  48. ./makeApidox.sh
  49. # Copy API docs to vcdevel.github.io
  50. git clone --depth 2 git@github.com:VcDevel/vcdevel.github.io && \
  51. cp -a doc/html vcdevel.github.io/Vc-$versionString && \
  52. cd vcdevel.github.io && \
  53. git add Vc-$versionString && \
  54. git commit -m "Add Vc $versionString release docs" && \
  55. git push && \
  56. cd .. && \
  57. rm -r vcdevel.github.io
  58. # Create API docs tarball
  59. mv doc/html/*.qch "../Vc-${versionString}.qch"
  60. mv doc/html "Vc-docs-$versionString" && tar -czf "../Vc-docs-$versionString".tar.gz "Vc-docs-$versionString"
  61. rm -rf "Vc-docs-$versionString"
  62. # Get back to the state before the tag and fix up the version numbers afterwards
  63. git revert -n HEAD
  64. git reset HEAD README.md && git checkout README.md
  65. # Update the version number of the after-release code
  66. versionString="$versionString-dev"
  67. versionNumber=`echo $versionNumber | awk '{ printf "0x%06x", (strtonum($0) + 1) }'`
  68. sed -i \
  69. -e "s/^PROJECT_NUMBER = .*\$/PROJECT_NUMBER = $versionString/" \
  70. -e "s/^HTML_TIMESTAMP = YES/HTML_TIMESTAMP = NO/" \
  71. doc/Doxyfile
  72. sed -i \
  73. -e "s/Vc_VERSION_STRING \".*\"\$/Vc_VERSION_STRING \"$versionString\"/" \
  74. -e "s/Vc_VERSION_NUMBER 0x.*\$/Vc_VERSION_NUMBER $versionNumber/" \
  75. Vc/version.h
  76. git commit CMakeLists.txt doc/Doxyfile Vc/version.h -s -F- <<EOF
  77. after release: version $versionString
  78. * change version strings/numbers to $versionString
  79. * enable HTML_TIMESTAMP for doxygen
  80. * build tests with make all
  81. EOF