diff --git a/hack/update-copyright.sh b/hack/update-copyright.sh index 43282dbce5..9ce785a3fa 100755 --- a/hack/update-copyright.sh +++ b/hack/update-copyright.sh @@ -16,4 +16,16 @@ ROOT_DIR='./' -for i in `grep -rlZ "Copyright [0-9]\{4\} The PipeCD Authors" $ROOT_DIR`; do sed -i '' "s/Copyright [0-9]\{4\} The PipeCD Authors/Copyright $(date +%Y) The PipeCD Authors/g" $i; done +# Detect OS for sed -i compatibility +if [[ "$OSTYPE" == "darwin"* ]]; then + SED_IN_PLACE="sed -i ''" +else + SED_IN_PLACE="sed -i" +fi + +grep -rl "Copyright [0-9]\{4\} The PipeCD Authors" $ROOT_DIR | while IFS= read -r i; do + echo "Updating copyright year in: $i" + $SED_IN_PLACE "s/Copyright [0-9]\{4\} The PipeCD Authors/Copyright $(date +%Y) The PipeCD Authors/g" "$i" +done + +echo "Copyright year update completed."