You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

deploySite.sh 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/bash
  2. #
  3. # Licensed to the Apache Software Foundation (ASF) under one
  4. # or more contributor license agreements. See the NOTICE file
  5. # distributed with this work for additional information
  6. # regarding copyright ownership. The ASF licenses this file
  7. # to you under the Apache License, Version 2.0 (the
  8. # "License"); you may not use this file except in compliance
  9. # with the License. You may obtain a copy of the License at
  10. #
  11. # http://www.apache.org/licenses/LICENSE-2.0
  12. #
  13. # Unless required by applicable law or agreed to in writing,
  14. # software distributed under the License is distributed on an
  15. # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. # KIND, either express or implied. See the License for the
  17. # specific language governing permissions and limitations
  18. # under the License.
  19. #
  20. # Author: Martin Stockhammer <martin_s@apache.org>
  21. # Date: 2018-11-15
  22. #
  23. # Publishes the site content and generated reports to the web content repository.
  24. # It stops after the staging and let you check the content before pushing to the repository
  25. #
  26. THIS_DIR=$(dirname $0)
  27. THIS_DIR=$(readlink -f ${THIS_DIR})
  28. CONTENT_DIR=".site-content"
  29. PROJECT_VERSION=$(grep '<version>' pom.xml |head -1 | sed -e 's/.*<version>\(.*\)<\/version>.*/\1/g')
  30. SUB_DIR="docs/${PROJECT_VERSION}"
  31. if [ -d "${CONTENT_DIR}/.git" ]; then
  32. git -C "${CONTENT_DIR}" fetch origin
  33. git -C "${CONTENT_DIR}" reset --hard origin/master
  34. fi
  35. echo ">>>> Creating site and reports <<<<"
  36. mvn clean site site:stage "$@"
  37. echo "*****************************************"
  38. echo ">>>> Finished the site stage process <<<<"
  39. echo "> You can check the content in the folder target/staging or by opening the following url"
  40. echo "> file://${THIS_DIR}/target/staging/${SUB_DIR}/index.html"
  41. echo "> "
  42. echo "> If everything is fine enter yes. After that the publish process will be started."
  43. echo -n "Do you want to publish (yes/no)? "
  44. read ANSWER
  45. if [ "${ANSWER}" == "yes" -o "${ANSWER}" == "YES" ]; then
  46. echo "> Starting publish process"
  47. mvn scm-publish:publish-scm "$@"
  48. else
  49. echo "> Aborting now"
  50. echo "> Running git reset in .site-content directory"
  51. git -C "${CONTENT_DIR}" fetch origin
  52. git -C "${CONTENT_DIR}" reset --hard origin/master
  53. echo ">>>> Finished <<<<"
  54. fi