Deploying with Bitbucket pipelines and alpine docker

Hello everyone,

For those who want to deploy their hugo website from bitbucket pipelines, I made a small howto. This doesn’t use aerobatic and deploys with rsync. Maybe we could expand the section in the documentation to provide an alternative ?

One benefit of my script is that it automatically select the latest version of Hugo for those who like to have the greatest things :slight_smile:

I copy paste the yml file below:


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 "YOURURL" -d public
          - rsync -avz --exclude "*.htaccess" --exclude ".well-known" --delete public/ USER@SERVER:~/public_html/
4 Likes

That’s pretty clever! I pin my configs to Hugo versions, but will keep that in mind. :slight_smile: