@edgelogistics/semantic-release
v1.5.13
Published
Package to use semantic release in a bitbucket project. This project is based on NPM semantic-release package, and is expected to be used with a semantic release configuration
Downloads
19
Keywords
Readme
Bitbucket Semantic Release
Package to use semantic release in a bitbucket project. This project is based on NPM semantic-release package, and is expected to be used with a semantic release configuration
Installation
To install this package run the following command in the terminal in the root directory of your application.
npm install --save-dev @edgelogistics/semantic-release
OR
yarn add --dev @edgelogistics/semantic-release
Usage
Add to your .releaserc or .releaserc.js or release.config.js
"extends": ["@edgelogistics/semantic-release"],
In order to use the deployment step, the env variable EXECUTE_RELEASE_SCRIPT
must be set to true and the env variable CUSTOM_PIPELINE_SELECTOR_TO_RELEASE
must be also be set the an existent custom pipe
To define the custom pipe you must add to the bitbucket-pipelines.yml
definitions:
steps:
- step: &deployment
name: Deployment
image: edgelogistics/node-16-alpine # This image must be able to use curl, bash and npm
script:
- echo "deploying"
pipelines:
custom:
echo:
- step: *deployment
In case that EXECUTE_BACK_MERGE_SCRIPT
is set to true, then a back merge would be executed by default between master to develop. You can change this behavior by setting the env variable ORIGIN_BRANCH_BACK_MERGE
and DESTINATION_BRANCH_BACK_MERGE
to the branches for the back merge, the ORIGIN_BRANCH_BACK_MERGE
is the source branch and the DESTINATION_BRANCH_BACK_MERGE
is the branch that will receive the back merge.
In case that EXECUTE_RELEASE_SCRIPT
is set to true, then the package will be published using the value passed in the env NPM_TOKEN
.
Variables
| Variable | Usage |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| EXECUTE_RELEASE_SCRIPT | Flag to see if the release custom pipeline must be executed. Default: false
|
| EXECUTE_BACK_MERGE_SCRIPT | Flag to see if the back merge script must be executed. Default: false
|
| PUBLISH_PACKAGE_TO_NPM | Flag to see if the package must be published to NPM. Default: false
|
| NPM_TOKEN | Flag to see if the package must be published to NPM. Required if PUBLISH_PACKAGE_TO_NPM is true
. |
| CUSTOM_PIPELINE_SELECTOR_TO_RELEASE | Name of the custom pipe to be executed in the release step. Required if EXECUTE_RELEASE_SCRIPT is true
. |
| ORIGIN_BRANCH_BACK_MERGE | Origin branch from where the back merge will be done. Default: master
. |
| DESTINATION_BRANCH_BACK_MERGE | Destination branch that will receive the back merge. Default: develop
. |
| BITBUCKET_REPO_OWNER | The bitbucket repo owner, used to build bitbucket url. Required if EXECUTE_RELEASE_SCRIPT is true
. Default: ${BITBUCKET_REPO_OWNER}
|
| BITBUCKET_REPO_SLUG | The bitbucket repo slug, used to build bitbucket url. Required if EXECUTE_RELEASE_SCRIPT is true
. Default: ${BITBUCKET_REPO_SLUG}
|
| GIT_CREDENTIALS | Credentials for bitbucket to execute the custom pipeline. Required if EXECUTE_RELEASE_SCRIPT is true
. Default: ${GIT_CREDENTIALS}
|
| DEBUG | Turn on extra debug information. Default: false
|
(*) = required variable.
Prerequisites
Examples
Basic example:
script:
- npm run semantic-release
Advanced example:
script:
- export PUBLISH_PACKAGE_TO_NPM=1
- export EXECUTE_RELEASE_SCRIPT=1
- export EXECUTE_BACK_MERGE_SCRIPT=1
- export CUSTOM_PIPELINE_SELECTOR_TO_RELEASE=deployment
- export NPM_TOKEN=yyy
- export GIT_CREDENTIALS=username:password
- npm run semantic-release
Executing Tests
Part of this library is tested using bats for the bash scripts, so is necessary to install the git submodules
git submodule update --init --recursive
npm install
chmod a+x test/*.bats
npm run test:bash
npm run test:js
Support
If you’d like help with this library, or you have an issue or feature request, let us know. The library is maintained by [email protected].
If you’re reporting an issue, please include:
- the version of the library
- relevant logs and error messages
- steps to reproduce