-
Notifications
You must be signed in to change notification settings - Fork 397
/
Copy pathupdate.sh
executable file
·37 lines (31 loc) · 1.38 KB
/
update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
set -e
function update_version() {
version=$1
latest=$(curl -s https://nodejs.org/dist/latest-v${version}.x/SHASUMS256.txt | head -1 | sed 's/^.*node-v//' | sed 's/-.*//')
curr=$(grep -oE "NODE_VERSION [0-9.]+" ${version}*/Dockerfile)
curr=${curr#* }
if [ "$curr" == "$latest" ]; then
return
fi
echo "Updating $curr -> $latest"
a=( ${curr//./ } )
curr_major="${a[0]}"
curr_major_minor="${a[0]}.${a[1]}"
a=( ${latest//./ } )
latest_major="${a[0]}"
latest_major_minor="${a[0]}.${a[1]}"
find ${curr_major} -type f -exec sed -i "" "s/${curr//./\\.}/$latest/g" {} +
find build* -type f -exec sed -i "" "s/${curr//./\\.}/$latest/g" {} +
find build* -type f -exec sed -i "" "s/${curr_major_minor//./\\.}/$latest_major_minor/g" {} +
find build* -type f -exec sed -i "" "s/${curr_major//./\\.}/$latest_major/g" {} +
find test* -type f -exec sed -i "" "s/${curr//./\\.}/$latest/g" {} +
find test* -type f -exec sed -i "" "s/${curr_major_minor//./\\.}/$latest_major_minor/g" {} +
find test* -type f -exec sed -i "" "s/${curr_major//./\\.}/$latest_major/g" {} +
find push* -type f -exec sed -i "" "s/${curr//./\\.}/$latest/g" {} +
find push* -type f -exec sed -i "" "s/${curr_major_minor//./\\.}/$latest_major_minor/g" {} +
find push* -type f -exec sed -i "" "s/${curr_major//./\\.}/$latest_major/g" {} +
}
update_version 12
#update_version 8
#update_version 6