💻 Tech
In Bitbucket, reusable steps are helpful to reduce the amount the code written and to enhance readability and maintainability of pipeline YAML files. In the example below, compile-step
was reused to run the step when a PR is created and a new commit is pushed to the main branch.
definitions:
steps:
- step: &compile-step
name: Compile node project
image: node:18-alpine
script:
- npm i
- npm run build
artifacts:
- dist/**
pipelines:
branches:
main:
- step: *compile-step
pull-requests:
'**':
- step: *compile-step