Minimalist Release Automation on Bitbucket Pipelines

I have previously written about automating releases in Gitlab. This post provides a simple Bitbucket pipeline configuration for achieving the same automation on their platform.

Before you start, set up an SSH key to allow Bitbucket pipelines to push commits back into your repository. Pipeline


version_bump.js

var v = require('./package.json').version
console.log(v)
const replace = require('replace-in-file');
const regex = new RegExp(/.*/, 'i');
const options = {
    files: '.version',
    from: regex,
    to: "v" + v,
};

var changes = replace.sync(options)

console.log("[skip ci] chore(release): " + v)