Created
January 25, 2021 11:29
-
-
Save flo-sch/3795619d76278c7e840b73b5cbc51f4e to your computer and use it in GitHub Desktop.
NPM publication with semantic release on bitbucket pipelines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# stable as of today | |
image: node:fermium | |
definitions: | |
steps: | |
- step: &test | |
name: Run tests | |
caches: | |
- node | |
script: | |
# Install dependencies | |
- yarn install --frozen-lockfile | |
# Run tests | |
- yarn run test | |
- step: &audit | |
name: Audit dependencies | |
caches: | |
- node | |
script: | |
# Install dependencies | |
- yarn install --frozen-lockfile | |
# Run audit, you may consider using services such as https://snyk.io/ | |
- yarn audit | |
- step: &release | |
name: Release a new version | |
caches: | |
- node | |
script: | |
# Worth reading: https://confluence.atlassian.com/bitbucket/push-back-to-your-repository-962352710.html | |
# Install dependencies | |
- yarn install --frozen-lockfile | |
# Trigger the release | |
- yarn semantic-release | |
branches: | |
# By default, test and audit | |
default: | |
- parallel: | |
- step: *test | |
- step: *audit | |
# custom pipelines can be scheduled: for instance to audit on a given frequency | |
custom: | |
audit: | |
- step: *audit | |
# Trigger releases from master branch (if both test and audit steps pass) | |
master: | |
- parallel: | |
- step: *test | |
- step: *audit | |
- step: *release |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment