Last active
July 13, 2020 04:46
-
-
Save tarao/506d8e66fbc7059db156a51eb4e5cbcb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
artifact="$1" | |
old="$2" | |
new="$3" | |
namespace="$(echo "$artifact" | cut -f 1 -d :)" | |
id="$(echo "$artifact" | cut -f 2 -d :)" | |
pom_url="https://repo1.maven.org/maven2/$(echo "$namespace" | tr . /)/$id/$new/$id-$new.pom" | |
pom_xml="$(curl -sL "$pom_url")" | |
scm_url="$(echo "$pom_xml" | xmllint --xpath "/*[local-name()='project']/*[local-name()='scm']/*[local-name()='url']/text()" -)" | |
url="$(echo "$pom_xml" | xmllint --xpath "/*[local-name()='project']/*[local-name()='url']/text()" -)" | |
scm_url="$(echo "$scm_url" | sed 's!^git@github.com:!https://github.com/!')" | |
scm_url="$(echo "$scm_url" | sed 's![.]git$!!')" | |
[ -n "$scm_url" ] && { | |
case "$scm_url" in | |
'https://github.com/'*) | |
[ "$(git ls-remote "$scm_url" "$new" | wc -l)" = 1 ] && { | |
echo "$scm_url/compare/${old}...${new}" | |
exit | |
} | |
[ "$(git ls-remote "$scm_url" "v$new" | wc -l)" = 1 ] && { | |
echo "$scm_url/compare/v${old}...v${new}" | |
exit | |
} | |
echo "$scm_url" | |
;; | |
*) | |
echo "$scm_url" | |
;; | |
esac | |
exit | |
} | |
[ -n "$url" ] && echo "$url" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(メモ) scala-stewardだとどうしてるか
vなんとか
の他にrelease-なんとか
も見てる200
が返るかどうかで判別してる404
になっているようだ