supersonic-models
Version:
Supersonic models and API specifications
95 lines (87 loc) • 3.03 kB
YAML
image: node:13.13
definitions:
steps:
- step: &semantic-versioning
name: Semantic Versioning
image:
name: 618004346723.dkr.ecr.ap-southeast-2.amazonaws.com/semantic-versioning:1.0.0
aws:
access-key: $AWS_ACCESS_KEY_ID
secret-key: $AWS_SECRET_ACCESS_KEY
script:
- chmod +x changeversion.sh
- chmod +x create-next-version-text-file.sh
- npx semantic-release
artifacts:
- nextversion.txt
- step: &prepare-npm
name: prepare npm for org login
script:
- mv .npmrc.example .npmrc
artifacts:
- .npmrc
- step:
name: Renovate
script:
- sed -i "20s/placeholder/${NPM_TOKEN}/" ./renovate.js
- docker run -e RENOVATE_PASSWORD="$RENOVATE_TOKEN" -e GITHUB_COM_TOKEN="${GITHUB_TOKEN}" -v $PWD/renovate.js:/usr/src/app/config.js renovate/renovate:23.40 ${BITBUCKET_REPO_FULL_NAME}
services:
- docker
options:
max-time: 10
pipelines:
default:
- step: *prepare-npm
- step:
name: test build
script:
- rm -rf node_modules/
- npm install
- npm run lint
- npm run build
custom:
renovate:
- step:
<<:
branches:
develop:
- step: *prepare-npm
- step:
<<:
- step:
name: Update version to beta, build & publish
script:
- npm version prerelease --preid=beta -m "ci(npm):\ bumped to %s [skip ci]"
- git remote set-url origin https://$GIT_CREDENTIALS@bitbucket.org/$BITBUCKET_REPO_FULL_NAME.git
- git push
- rm -rf node_modules/
- npm install
- npm run lint
- npm run build
- npm publish
release/**:
- step: *prepare-npm
- step:
name: Update version to release candidate, deploy & publish
script:
- npm version prerelease --preid=rc -m "ci(npm):\ bumped to %s [skip ci]"
- git remote set-url origin https://$GIT_CREDENTIALS@bitbucket.org/$BITBUCKET_REPO_FULL_NAME.git
- git push
- rm -rf node_modules/
- npm install
- npm run lint
- npm run build
- npm publish
master:
- step: *prepare-npm
- step: *semantic-versioning # Only branch where we should semantically change version
- step:
name: Build & Deploy
script:
# Check if there's a new version to deploy then Install git and get the previously committed tag
- if [[ -e ./nextversion.txt ]]; then CODE_VERSION=$(cat ./nextversion.txt) && apk add --no-cache bash git openssh && git pull && git checkout tags/v-$CODE_VERSION ; else echo "There's no new version"; fi
- rm -rf node_modules/
- npm install
- npm run lint
- npm run build
- npm publish