Bitbucket Pipelines share SOME steps between branches

Although it's not officially supported yet, you can pre-define steps now.
You can use yaml anchors. I got this tip from bitbucket staff when I had an issue running the same steps across a subset of branches.

definitions:
  step: &Build
    name: Build
    script:
      - npm install
      - npm build

pipelines:
  default:
    - step: *Build
  branches:
    master:
      - step: *Build
      - step:
          name: deploy
          # do some deploy from master only

Use YAML anchors:

definitions:
  steps:
    - step: &Test-step
        name: Run tests
        script:
          - npm install
          - npm run test
    - step: &Deploy-step
        name: Deploy to staging
        deployment: staging
        script:
          - npm install
          - npm run build
          - fab deploy
pipelines:
  default:
    - step: *Test-step
    - step: *Deploy-step
  branches:
    master:
      - step: *Test-step
      - step:
        <<: *Deploy-step
        name: Deploy to production
        deployment: production
        trigger: manual

Docs: https://confluence.atlassian.com/bitbucket/yaml-anchors-960154027.html