-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a54ad1
commit bbbb696
Showing
1 changed file
with
82 additions
and
84 deletions.
There are no files selected for viewing
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
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: /.*/ |