-
Notifications
You must be signed in to change notification settings - Fork 23
/
goFeed.sh
executable file
·91 lines (73 loc) · 2.72 KB
/
goFeed.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env bash
vers=()
if [ -f shared/automated-updates.sh ]; then
source shared/automated-updates.sh
else
echo "Check if submodule was loaded; automated-updates.sh is missing"
exit 1
fi
getGoVulnCheck() {
local templateFile=$1
RSS_URL="https://github.com/golang/vuln/tags.atom"
VERSIONS=$(curl --silent "$RSS_URL" | grep -E '(title)' | tail -n +2 | sed -e 's/^[ \t]*//' | sed -e 's/<title>//' -e 's/<\/title>//' | tr -d ':')
for version in $VERSIONS; do
if [[ $version =~ ^v[0-9]+(\.[0-9]+)*$ ]]; then
generateVersions "$(cut -d "v" -f2 <<< "${version}")"
generateSearchTerms "GOVULNCHECK_V=" "$templateFile"
replaceVersions "GOVULNCHECK_V=" "$SEARCH_TERM" "true"
fi
done
}
getGoTestSum() {
local templateFile=$1
RSS_URL="https://github.com/gotestyourself/gotestsum/tags.atom"
VERSIONS=$(curl --silent "$RSS_URL" | grep -E '(title)' | tail -n +2 | sed -e 's/^[ \t]*//' | sed -e 's/<title>//' -e 's/<\/title>//')
for version in $VERSIONS; do
if [[ $version =~ ^v[0-9]+(\.[0-9]+)*$ ]]; then
generateVersions "$(cut -d "v" -f2 <<< "${version}")"
generateSearchTerms "GOTESTSUM_V=" "$templateFile"
replaceVersions "GOTESTSUM_V=" "$SEARCH_TERM" "true"
fi
done
}
getGoCILint () {
local templateFile=$1
RSS_URL="https://github.com/golangci/golangci-lint/tags.atom"
VERSIONS=$(curl --silent "$RSS_URL" | grep -E '(title)' | tail -n +2 | sed -e 's/^[ \t]*//' | sed -e 's/<title>//' -e 's/<\/title>//')
for version in $VERSIONS; do
if [[ $version =~ ^v[0-9]+(\.[0-9]+)*$ ]]; then
generateVersions "$(cut -d "v" -f2 <<< "${version}")"
generateSearchTerms "GOCI_LINT_V=" "$templateFile"
replaceVersions "GOCI_LINT_V=" "$SEARCH_TERM" "true"
fi
done
}
getGoVersion() {
echo "Getting Go Test Sum Versions..."
getGoTestSum "Dockerfile.template"
echo "Getting Go Lint Versions..."
getGoCILint "Dockerfile.template"
echo "Getting Go Vuln Check Versions..."
getGoVulnCheck "Dockerfile.template"
RSS_URL="https://github.com/golang/go/tags.atom"
VERSIONS=$(curl --silent "$RSS_URL" | grep -E '(title)' | tail -n +2 | sed -e 's/^[ \t]*//' | sed -e 's/<title>//' -e 's/<\/title>//')
for version in $VERSIONS; do
if [[ $version =~ ^go[0-9]+(\.[0-9]+)*$ ]]; then
generateVersions "$(trimmer "go" <<< "$version")"
generateSearchTerms "GO_VER=" "$majorMinor/Dockerfile" '"'
directoryCheck "$majorMinor" "$SEARCH_TERM"
if [[ $(eval echo $?) == 0 ]]; then
generateVersionString "$newVersion"
fi
fi
done
}
getGoVersion
if [ -n "${vers[*]}" ]; then
echo "Included version updates: ${vers[*]}"
echo "Running release script"
./shared/release.sh "${vers[@]}"
else
echo "No new version updates"
exit 0
fi