summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorSemyon Maryasin2019-03-23 02:19:09 +0300
committerSemyon Maryasin2019-03-23 02:19:59 +0300
commit3777fc115f6dec26384258728066f6c1b728e3c8 (patch)
tree4dab7b858824d83d57cc74ef88354c11bda58af8
parentd7cfcf710302c83437d00c6a8c69c78adae408b8 (diff)
downloadaur-3777fc115f6dec26384258728066f6c1b728e3c8.tar.gz
Use Github API for latest version detection
Rather than messing with HTML
-rw-r--r--.SRCINFO2
-rw-r--r--PKGBUILD9
2 files changed, 7 insertions, 4 deletions
diff --git a/.SRCINFO b/.SRCINFO
index e169f79ca65c..be1cda332c0f 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -10,7 +10,7 @@ pkgbase = zeit-now-bin
provides = zeit-now
conflicts = nodejs-now
options = !strip
- source = https://github.com/zeit/now-cli/releases/latest
+ source = https://api.github.com/repos/zeit/now-cli/releases/latest
md5sums = SKIP
pkgname = zeit-now-bin
diff --git a/PKGBUILD b/PKGBUILD
index c9b256baaf14..e8de6de01ed4 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -26,7 +26,7 @@ options=("!strip")
install=
changelog=
# Actually this is just an information about the latest version.
-source=("https://github.com/zeit/now-cli/releases/latest")
+source=("https://api.github.com/repos/zeit/now-cli/releases/latest")
noextract=()
md5sums=('SKIP')
validpgpkeys=()
@@ -34,8 +34,11 @@ validpgpkeys=()
pkgver() {
# Could not find a way to check version *before* downloading sources,
# so we fetch version information instead of sources
- # and then download the real binary in build()
- cat latest | grep -o 'tag/[^"]*' | sed 's:tag/::'
+ # and then download the real binary in build().
+ # The data in `latest` is a pretty-printed JSON.
+ # We could parse it using `jq` package, but let's not introduce extra dependencies
+ # for such trivial case.
+ cat latest | grep -Po '(?<="tag_name":)\s*"[0-9.]*"' | tr -d '" '
}
build() {