bump-change-date.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/usr/bin/env bash
  2. # Copyright Materialize, Inc. and contributors. All rights reserved.
  3. #
  4. # Use of this software is governed by the Business Source License
  5. # included in the LICENSE file at the root of this repository.
  6. #
  7. # As of the Change Date specified in that file, in accordance with
  8. # the Business Source License, use of this software will be governed
  9. # by the Apache License, Version 2.0.
  10. #
  11. # bump-change-date — updates the change date in the LICENSE file.
  12. set -euo pipefail
  13. git_date=$(date "+%B %d, %Y 00:00:00 UTC")
  14. change_date=$(date -d "+4 years" "+%B %d, %Y")
  15. version_date=$(date "+%Y%m%d")
  16. year=$(date "+%Y")
  17. export GIT_AUTHOR_DATE=$git_date
  18. export GIT_COMMITTER_DATE=$git_date
  19. export GIT_AUTHOR_NAME=Materialize Bot
  20. export GIT_AUTHOR_EMAIL=infra+bot@materialize.com
  21. export GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
  22. export GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
  23. git checkout main
  24. git pull
  25. sed -Ei \
  26. -e "s/Licensed Work:.*/Licensed Work: Materialize Version $version_date/g" \
  27. -e "s/Change Date:.*/Change Date: $change_date/g" \
  28. -e "s/The Licensed Work is © [0-9]{4}/The Licensed Work is © $year/g" \
  29. LICENSE
  30. git add LICENSE
  31. git commit -m "LICENSE: update change date"
  32. git push "https://materializebot:$GITHUB_TOKEN@github.com/MaterializeInc/materialize.git" main