1
+ #! /usr/bin/env bash
2
+ source manifest
3
+ vers=()
4
+
5
+ if [ -f shared/automated-updates.sh ]; then
6
+ source shared/automated-updates.sh
7
+ else
8
+ echo " Check if submodule was loaded; automated-updates.sh is missing"
9
+ exit 1
10
+ fi
11
+
12
+ buildParameter () {
13
+ local newVersionString=$1
14
+ export builtParam=" #$( echo " $newVersionString " | awk -F. ' {print $NF}' ) "
15
+ }
16
+
17
+ getLeinVersion () {
18
+ local templateFile=$1
19
+
20
+ RSS_URL=" https://github.com/technomancy/leiningen/tags.atom"
21
+ VERSIONS=$( curl --silent " $RSS_URL " | grep -E ' (title)' | tail -n +2 | sed -e ' s/^[ \t]*//' | sed -e ' s/<title>//' -e ' s/<\/title>//' )
22
+
23
+ for version in $VERSIONS ; do
24
+ if [[ $version =~ [0-9]+ (\. [0-9]+)* $ ]]; then
25
+ generateVersions " $version "
26
+ generateSearchTerms " LEIN_VERSION=" " $templateFile " " "
27
+ replaceVersions " LEIN_VERSION=" " $SEARCH_TERM " " true"
28
+ fi
29
+ done
30
+ }
31
+
32
+ getClojureVersion () {
33
+
34
+ echo " Getting Lein version..."
35
+ getLeinVersion " Dockerfile.template"
36
+
37
+ # RSS_URL="https://github.com/clojure/clojure/tags.atom"
38
+ # VERSIONS=$(curl --silent "$RSS_URL" | grep -E '(title)' | tail -n +2 | sed -e 's/^[ \t]*//' | sed -e 's/<title>//' -e 's/<\/title>//')
39
+ VERSIONS=$( cat temp-versions)
40
+ for version in $VERSIONS ; do
41
+ if [[ $version =~ ^clojure-[0-9]+ (\. [0-9]+)* $ ]]; then
42
+ version_copy=" $( cut -d ' -' -f2 <<< " $version" ) "
43
+ generateVersions " $( cut -d ' -' -f2 <<< " $version" ) "
44
+ generateSearchTerms " CLOJURE_VERSION=" " $majorMinor /${parentTags[-1]} /Dockerfile" " \\ "
45
+ releaseVersion=$( curl -sSL https://api.github.com/repos/clojure/brew-install/releases |
46
+ jq -r --arg version " $version_copy " ' map(select(.target_commitish == $version)) | sort_by(.created_at) | last | .tag_name' )
47
+ buildParameter " $releaseVersion "
48
+ directoryCheck " $majorMinor " " $SEARCH_TERM " " $builtParam "
49
+ if [[ $( eval echo $? ) == 0 ]]; then
50
+ generateVersionString " $newVersion " " $builtParam "
51
+ fi
52
+
53
+ fi
54
+ done
55
+ }
56
+
57
+ getClojureVersion
58
+ # vers=($(printf "%s\n" "${vers[@]}" | sort -n))
59
+ if [ -n " ${vers[*]} " ]; then
60
+ echo " Included version updates: ${vers[*]} "
61
+ echo " Running release script"
62
+ ./shared/release.sh " ${vers[@]} "
63
+ else
64
+ echo " No new version updates"
65
+ exit 0
66
+ fi
0 commit comments