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.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. BRANCH="asf-staging-3.0"
  30. VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
  31. PUBLISH_PATH=$(mvn help:evaluate -Dexpression=scmPublishPath -q -DforceStdout)
  32. BRANCH=$(mvn help:evaluate -Dexpression=scmPublishBranch -q -DforceStdout)
  33. CONTENT_DIR=$(mvn help:evaluate -Dexpression=scmPubCheckoutDirectory -q -DforceStdout)
  34. if [ -d "${CONTENT_DIR}/.git" ]; then
  35. git -C "${CONTENT_DIR}" fetch origin
  36. git -C "${CONTENT_DIR}" checkout ${BRANCH}
  37. git -C "${CONTENT_DIR}" reset --hard origin/${BRANCH}
  38. git -C "${CONTENT_DIR}" clean -f -d
  39. fi
  40. echo ">>>> Creating site and reports <<<<"
  41. mvn clean site "$@"
  42. mvn site:stage "$@"
  43. echo "*****************************************"
  44. echo ">>>> Finished the site stage process <<<<"
  45. echo "> You can check the content in the folder target/staging or by opening the following url"
  46. echo "> file://${THIS_DIR}/target/staging${PUBLISH_PATH}/index.html"
  47. echo "> "
  48. echo "> If everything is fine enter yes. After that the publish process will be started."
  49. echo -n "Do you want to publish (yes/no)? "
  50. read ANSWER
  51. if [ "${ANSWER}" == "yes" -o "${ANSWER}" == "YES" -o "${ANSWER}" == "y" -o "${ANSWER}" == "Y" ]; then
  52. echo "> Starting publish process"
  53. mvn scm-publish:publish-scm "$@"
  54. else
  55. echo "> Aborting now"
  56. echo "> Running git reset in .site-content directory"
  57. git -C "${CONTENT_DIR}" fetch origin
  58. git -C "${CONTENT_DIR}" reset --hard origin/${BRANCH}
  59. git -C "${CONTENT_DIR}" clean -f -d
  60. echo ">>>> Finished <<<<"
  61. fi