snap: Set "extended" tag based on build_url on Launchpad

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.
This commit is contained in:
Anthony Fok 2018-10-11 22:56:53 +08:00
parent 3d4a9882bf
commit d14420539a
No known key found for this signature in database
GPG key ID: EA2500B412C59ACF

View file

@ -42,7 +42,12 @@ parts:
export GO111MODULE=on export GO111MODULE=on
mage -v test 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 [ "$SNAPCRAFT_PROJECT_GRADE" = "stable" ] && mage -v hugoNoGitInfo || mage -v hugo
./hugo version ./hugo version
ldd hugo || : ldd hugo || :