Skip to content
Merged
62 changes: 30 additions & 32 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ node-defaults: &node-defaults
working_directory: *workspace
executor:
name: node/default
tag: 13.10.1
tag: 22.14.0

release-filter: &release-filter
filters:
Expand All @@ -16,53 +16,51 @@ release-filter: &release-filter
ignore: /.*/

orbs:
node: circleci/node@1.1.6
node: circleci/node@7.1.0

jobs:
build-and-test:
<<: *node-defaults
steps:
- checkout
- node/with-cache:
steps:
- run: npm install
- run: npm test -- --verbose
- node/install-packages:
pkg-manager: npm
- run: npm test -- --verbose
- persist_to_workspace:
root: .
paths: .

publish-release:
<<: *node-defaults
steps:
- add_ssh_keys:
fingerprints:
- "SHA256:7SVF3W6ho6Rati2rOygoU2UtEH8EGZ43q8FhcHER9Bc"
- checkout
- attach_workspace:
at: *workspace
- node/with-cache:
steps:
- run:
name: Validate release version
command: |
TAG=${CIRCLE_TAG:1}
CURRENT_VERSION=$(node -p "require('./package.json').version")
if [ "$TAG" == "$CURRENT_VERSION" ]; then
echo "Release tag matches current version"
else
echo "Release tag does not match current version"
exit 1
fi
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > $PWD/.npmrc
- run: npm publish
- run: echo 'export DEFAULT_BRANCH=$(git remote show origin | grep HEAD | cut -d ":" -f2- | xargs)' >> $BASH_ENV
- run:
name: Set git information
command: |
git config --global user.email "twilio-sdk-build@twilio.com"
git config --global user.name "twilio-sdk-build"
- run: git checkout $DEFAULT_BRANCH
- run: npm --no-git-tag-version version patch
- run: git add package.json
- run: git commit -m "Bump version after release [skip ci]"
- run: git push origin $DEFAULT_BRANCH
- node/install-packages:
pkg-manager: npm
- run:
name: Validate release version
command: |
TAG=${CIRCLE_TAG:1}
CURRENT_VERSION=$(node -p "require('./package.json').version")
if [ "$TAG" == "$CURRENT_VERSION" ]; then
echo "Release tag matches current version"
else
echo "Release tag does not match current version"
exit 1
fi
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > $PWD/.npmrc
- run: npm publish
- run: echo 'export DEFAULT_BRANCH=$(git remote show origin | grep HEAD | cut -d ":" -f2- | xargs)' >> $BASH_ENV
- run: git checkout $DEFAULT_BRANCH
- run: npm --no-git-tag-version version patch
- run: git add package.json
- run: git add package-lock.json
- run: git commit -m "Bump version after release [skip ci]"
- run: git push origin $DEFAULT_BRANCH

workflows:
build-and-test:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
node_modules/
npm-debug.log*
package-lock.json
Loading