Skip to content

Commit beb3c9e

Browse files
committed
chore: Simplify yarn version update
Before commit 3f6cb08 (fix: only update yarn if there are other changes to the dockerfile), yarnVersion depended on SKIP, so the substitute that followed made sense. This commit removed the condition and changed it to just substitute the version with itself, which doesn't make much sense. Just remove it, and also move the real replace inside SKIP condition.
1 parent e60f6a8 commit beb3c9e

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

update.sh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,6 @@ function update_node_version() {
135135
sed -Ei -e 's/^FROM (.*)/FROM '"$fromprefix"'\1/' "${dockerfile}-tmp"
136136
sed -Ei -e 's/^(ENV NODE_VERSION ).*/\1'"${nodeVersion}"'/' "${dockerfile}-tmp"
137137

138-
currentYarnVersion="$(grep "ENV YARN_VERSION" "${dockerfile}" | cut -d' ' -f3)"
139-
sed -Ei -e 's/^(ENV YARN_VERSION ).*/\1'"${currentYarnVersion}"'/' "${dockerfile}-tmp"
140-
141138
# shellcheck disable=SC1004
142139
new_line=' \\\
143140
'
@@ -172,11 +169,9 @@ function update_node_version() {
172169
if diff -q "${dockerfile}-tmp" "${dockerfile}" > /dev/null; then
173170
echo "${dockerfile} is already up to date!"
174171
else
175-
if [ "${SKIP}" = true ]; then
176-
# Get the currently used Yarn version
177-
yarnVersion="$(grep "ENV YARN_VERSION" "${dockerfile}" | cut -d' ' -f3)"
172+
if [ "${SKIP}" != true ]; then
173+
sed -Ei -e 's/^(ENV YARN_VERSION ).*/\1'"${yarnVersion}"'/' "${dockerfile}-tmp"
178174
fi
179-
sed -Ei -e 's/^(ENV YARN_VERSION ).*/\1'"${yarnVersion}"'/' "${dockerfile}-tmp"
180175
echo "${dockerfile} updated!"
181176
fi
182177

0 commit comments

Comments
 (0)