snap: Set "extended" tag based on build_url on Launchpad
authorAnthony Fok <foka@debian.org>
Thu, 11 Oct 2018 14:56:53 +0000 (22:56 +0800)
committerAnthony Fok <foka@debian.org>
Fri, 12 Oct 2018 03:10:38 +0000 (11:10 +0800)
Read build_url from $SNAPCRAFT_IMAGE_INFO to determine whether
to add the "extended" build tag or not.  This allows us to do away
with the extended-snap-master and extended-snap-stable branches.

snap/snapcraft.yaml

index c7b2a8a60412189595839f1b5f513de930933486..6967b9fc2ef27bad8d27f7d4ea292791c587de4f 100644 (file)
@@ -42,7 +42,12 @@ parts:
       export GO111MODULE=on
       mage -v test
 
-      echo " * Building hugo (build tag: none)..."
+      echo " * SNAPCRAFT_IMAGE_INFO=$SNAPCRAFT_IMAGE_INFO"
+      # Example: SNAPCRAFT_IMAGE_INFO='{"build_url": "https://launchpad.net/~gohugoio/+snap/hugo-extended-dev/+build/344022"}'
+      if echo $SNAPCRAFT_IMAGE_INFO | grep -q '/+snap/hugo-extended'; then
+          export HUGO_BUILD_TAGS="extended"
+      fi
+      echo " * Building hugo (HUGO_BUILD_TAGS=\"$HUGO_BUILD_TAGS\")..."
       [ "$SNAPCRAFT_PROJECT_GRADE" = "stable" ] && mage -v hugoNoGitInfo || mage -v hugo
       ./hugo version
       ldd hugo || :