|
2 | 2 | # COMMON FUNCTIONS |
3 | 3 |
|
4 | 4 | # |
5 | | -# © 2026-2026 JDHeim.com |
6 | | -# |
7 | | -# Licensed under the Apache License, Version 2.0 (the "License"); |
8 | | -# you may not use this file except in compliance with the License. |
9 | | -# You may obtain a copy of the License at |
10 | | -# |
11 | | -# https://www.apache.org/licenses/LICENSE-2.0 |
12 | | -# |
13 | | -# Unless required by applicable law or agreed to in writing, software |
14 | | -# distributed under the License is distributed on an "AS IS" BASIS, |
15 | | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | | -# See the License for the specific language governing permissions and |
17 | | -# limitations under the License. |
| 5 | +# Copyright 2026 JDHeim.com |
| 6 | +# SPDX-License-Identifier: Apache-2.0 |
18 | 7 | # |
19 | 8 |
|
20 | 9 | set -o errexit # ABORT ON NON-ZERO EXIT STATUS |
@@ -43,6 +32,7 @@ run() { |
43 | 32 | echo -e "${INFO} \e[1m$\e[0m $*"; "$@" |
44 | 33 | } |
45 | 34 |
|
| 35 | +## trim "string" |
46 | 36 | trim() { |
47 | 37 | local string="${1}" |
48 | 38 | string="${string#"${string%%[![:space:]]*}"}" |
@@ -87,28 +77,7 @@ updatePropertyInXmlFile() { |
87 | 77 | fi |
88 | 78 | } |
89 | 79 |
|
90 | | -## updateCopyrightInFile "README.md" |
91 | | -updateCopyrightInFile() { |
92 | | - local file="${1}" |
93 | | - local oldValue newValue |
94 | | - copyrightsStartYear="$(grep -E "© [0-9]{4}-[0-9]{4} JDHeim.com" "${file}" | sed -E 's/.*([0-9]{4})-.*/\1/')" |
95 | | - oldValue="$(grep -E "© [0-9]{4}-[0-9]{4} JDHeim.com" "${file}" | sed -E 's/.*-([0-9]{4}).*/\1/')" |
96 | | - newValue="$(date +%Y)" |
97 | | - if [[ "${oldValue}" != "${newValue}" ]]; then |
98 | | - echo -e "${INFO} Updating ${file}: ${copyrightsStartYear}-${oldValue} -> ${copyrightsStartYear}-${newValue}" |
99 | | - sed -i "s/\(©\).*\(JDHeim.com\)/\1 ${copyrightsStartYear}-${newValue} \2/" "${file}" |
100 | | - isUpdated=true |
101 | | - fi |
102 | | -} |
103 | | - |
104 | | -## findAndUpdateCopyright "*.md" |
105 | | -findAndUpdateCopyright() { |
106 | | - local name="${1}" |
107 | | - for file in $(grep -ERil --include="${name}" --exclude-dir={target} "© [0-9]{4}-[0-9]{4} JDHeim.com"); do |
108 | | - updateCopyrightInFile "${file}" |
109 | | - done |
110 | | -} |
111 | | - |
| 80 | +## githubStepSummary "${exitCode}" "${logFile}" "^[[]INFO[]] Check for updates complete" |
112 | 81 | githubStepSummary() { |
113 | 82 | local exitCode=${1} |
114 | 83 | local logFile="${2}" |
|
0 commit comments