I wanted to be able to use always the latest version of hugo. However, the jq version provided by the default image of bitbucker is rather old.
Therefore, I used alpine linux image with allows much more recent version of the tools.
In order to use bitbucket pipelines, it was really easy. Just create a file
image: alpine:latest pipelines: default: - step: script: - apk update - apk add jq wget rsync ca-certificates openssh-client - wget https://api.github.com/repos/gohugoio/hugo/releases/latest -O - | jq -r '.assets | select(.name | index("Linux-64bit.tar.gz")) | .browser_download_url' | wget -i - - tar xzf hugo*.tar.gz - chmod a+x hugo - ./hugo -b "https://www.slurdge.org/" -d public - rsync -avz --exclude "*.htaccess" --exclude ".well-known" --delete public/ email@example.com:~/public_html/
This is slightly slower than using the default image, but it will always pull the latest hugo. Enjoy!
Alternatively, you can use the following jq command that works with version 1.3 (provided by bitbucket default image):
jq -r ".assets | select(.name | contains(\"Linux-64bit.deb\")) | .browser_download_url"