Settings

Using Bitbucket Pipelines

In my last post (I know it’s been awhile) I described my use of Buddy.Works for the deployment process. Well since Bitbucket uses it’s own deployment pipelines and because for work it was better to use the same tool for everything, I started to read up on pipelines.

The result is a bitbucket-pipelines.yml file for my Bitbucket Repository which handles the build and deployment process.

image: node:10.15.3

pipelines:
  branches:
    master:
    - step:
        name: Build CSS
        caches:
          - node
        script:
          - npm install -g gulp
          - npm install
          - gulp sass
        artifacts:
          - style.css
    - step:
        name: Deploy Theme
        deployment: production
        script:
          - pipe: atlassian/rsync-deploy:0.3.2
            variables:
              USER: '$REMOTE_USER'
              SERVER: '$REMOTE_SERVER'
              REMOTE_PATH: '$REMOTE_PATH'
              LOCAL_PATH: '/opt/atlassian/pipelines/agent/build/'
              EXTRA_ARGS: '--exclude-from=deployment-exclude-list.txt'

I’m only working with a master branch but of course you could expand that to a staging site with a development branch as well.

The first step builds the CSS out of the SCSS file and the second step uses rsync to copy the changed files from the repository to the remote server. There’s also a deployment-exclude-list.txt with a few files which don’t need to be copied.

Deployment now takes around 30-40 seconds and it’s all neatly integrated into Bitbucket, which is kinda nice.

For now I won’t use Buddy.Works for a while, even though they have some very nice features and keep on adding new ones, like Lighthouse testing. But maybe Bitbucket will add new features as well or I will find out how to include Lighthouse testing into my pipelines as well.