Skip to content

Commit

Permalink
updated config
Browse files Browse the repository at this point in the history
  • Loading branch information
bateman001 committed Dec 9, 2024
1 parent 2a54ad1 commit bbbb696
Showing 1 changed file with 82 additions and 84 deletions.
166 changes: 82 additions & 84 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,91 +1,89 @@
version: 2.1

orbs:
node: circleci/node@6.3
node: circleci/node@7.0.0

jobs:
build-and-test:
executor:
name: node/default
tag: '18.20.0'
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- run:
name: Install
command: npm ci
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run:
name: Audit
command: npm audit --audit-level=low
- run:
name: Test
command: npm run test
- run:
name: Build
command: npm run build
- persist_to_workspace:
root: .
paths: .
deploy-package:
executor:
name: node/default
tag: '18.20.0'
steps:
- attach_workspace:
at: ~/repo
- run:
name: Authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=$npm_TOKEN" > .npmrc
- run:
name: Publish package
command: |
PACKAGE_VERSION=$(cat ./package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
if [[ $PACKAGE_VERSION == *"beta"* ]];
then
IS_BETA="true"
else
IS_BETA="false"
fi
if [ $IS_BETA == "true" ];
then
npm publish --access public --tag beta
else
npm publish --access public
fi
build-and-test:
executor:
name: node/default
tag: "18.20.0"
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- run:
name: Install
command: npm ci
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run:
name: Audit
command: npm audit --audit-level=low
- run:
name: Test
command: npm run test
- run:
name: Build
command: npm run build
- persist_to_workspace:
root: .
paths: .
deploy-package:
executor:
name: node/default
tag: "18.20.0"
steps:
- attach_workspace:
at: ~/repo
- run:
name: Authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=$npm_TOKEN" > .npmrc
- run:
name: Publish package
command: |
PACKAGE_VERSION=$(cat ./package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
if [[ $PACKAGE_VERSION == *"beta"* ]];
then
IS_BETA="true"
else
IS_BETA="false"
fi
if [ $IS_BETA == "true" ];
then
npm publish --access public --tag beta
else
npm publish --access public
fi
workflows:
version: 2
build-deploy:
jobs:
- build-and-test:
filters:
branches:
ignore: main
- hold:
type: approval
requires:
- build-and-test
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- deploy-package:
requires:
- hold
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
build-deploy:
jobs:
- build-and-test:
filters:
branches:
ignore: main
- hold:
type: approval
requires:
- build-and-test
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- deploy-package:
requires:
- hold
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/

0 comments on commit bbbb696

Please sign in to comment.