Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add release scripts #93

Merged
merged 12 commits into from
Apr 18, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 68 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@ version: 2.1

supported-eslint-versions: &supported-eslint-versions ["local", "7"]

deploy_filters: &deploy_filters
filters:
branches:
ignore: /.*/
tags:
# Trigger on tags that begin with `v`
only: /^v.*/

commands:
save_v1_cache:
description: Save cache for future build
steps:
- save_cache:
key: v1-dependencies-{{ checksum "yarn.lock" }}
paths:
- node_modules
restore_v1_cache:
description: Restore cache from previous build
steps:
- restore_cache:
keys:
- v1-dependencies-{{ checksum "yarn.lock" }}
- v1-dependencies-


jobs:
build:
parameters:
Expand All @@ -15,18 +40,12 @@ jobs:
- image: circleci/node
steps:
- checkout
- restore_v1_cache
- run:
name: Install dependencies and build
command: yarn install --frozen-lockfile

- restore_cache:
keys:
- v1-dependencies-{{ checksum "yarn.lock" }}
- v1-dependencies-

- run: yarn install --frozen-lock

- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "yarn.lock" }}
- save_v1_cache
- when:
condition:
not:
Expand All @@ -35,9 +54,32 @@ jobs:
- run:
name: Override version of eslint@<<parameters.eslint-version>>
command: yarn add eslint@<<parameters.eslint-version>> --dev
- run: yarn format:check
- run: yarn lint
- run: yarn test
- run:
name: Check formatting
command: yarn format:check
- run:
name: Run linter
command: yarn lint
- run:
name: Run unit tests
command: yarn test

deploy:
docker:
- image: circleci/node
steps:
- checkout
- restore_v1_cache
- run:
name: Install dependencies and build
command: yarn install --frozen-lockfile
- run:
name: Configure NPM authentication
command: npm config set "//registry.npmjs.org/:_authToken" "$NPM_AUTOMATION_TOKEN"
- run:
name: Publish package
command: yarn release:publish:ci


workflows:
build_and_test:
Expand All @@ -46,3 +88,15 @@ workflows:
matrix:
parameters:
eslint-version: *supported-eslint-versions
build_and_test_and_deploy:
jobs:
- build:
<<: *deploy_filters
matrix:
parameters:
eslint-version: *supported-eslint-versions

- deploy:
<<: *deploy_filters
requires:
- build
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"format": "prettier --write --ignore-path .gitignore \"**/*.{js,md}\"",
"format:check": "prettier --check --ignore-path .gitignore \"**/*.{js,md}\"",
"lint": "eslint lib/ test/",
"test": "nyc mocha"
"test": "nyc mocha",
"release:version": "npm version",
"release:publish:ci": "npm publish --registry=https://registry.npmjs.org --dry-run"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove the --dry-run tag AFTER review for safety.

},
"devDependencies": {
"@babel/core": "^7.17.8",
Expand Down