Skip to content

Commit

Permalink
Add continuous delivery via 'auto' package (#46)
Browse files Browse the repository at this point in the history
* Add continuous delivery via 'auto' package

* Update CONTRIBUTING and PR template

* Update CircleCI 'pull-request' workflow order

* Fix dependency-cache-key in CircleCI config
  • Loading branch information
smithki committed Nov 17, 2020
1 parent a187524 commit bc4bc51
Show file tree
Hide file tree
Showing 6 changed files with 802 additions and 46 deletions.
90 changes: 67 additions & 23 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
# ---------------------------------------------------------------------------- #
# CI OVERVIEW #
# ~~~~~~~~~~~ #
# #
# 1) The following scripts should be preserved in `package.json`: #
# #
# lint -- Run a linter against source files. #
# build -- Build CJS and UMD bundles for the module. #
# test -- Run unit tests and build a coverage report using #
# Istanbul/`nyc`. #
# #
# #
# 2) Ensure the aliases for `&dependency-paths` and `&build-output-paths` #
# below properly reflect the dependency and output directories #
# of the module. #
# #
# ---------------------------------------------------------------------------- #

version: 2.1

# --- YAML Aliases ----------------------------------------------------------- #
Expand All @@ -34,7 +16,7 @@ aliases: [
],

# NPM lockfile cache key (update "vN" => "vN+1" to cache-bust).
&dependency-cache-key "v1-dependency-cache-{{ checksum \"yarn-lock.json\" }}",
&dependency-cache-key "v2-dependency-cache-{{ checksum \"yarn.lock\" }}",

&workspace-root "/home/circleci/project",

Expand All @@ -43,6 +25,27 @@ aliases: [
at: *workspace-root
}
},

# Filter pull requests not in "master" or "next" (development code)
&filter-default-branches {
filters: {
branches: {
ignore: "/^master$|^next$/"
}
}
},

# Filter pull requests in "master" or "next" only (production code).
&filter-release-branches-only {
filters: {
branches: {
only: [
"master",
"next",
]
}
}
},
]

# --- Executor definitions --------------------------------------------------- #
Expand Down Expand Up @@ -110,24 +113,65 @@ jobs:
- store_artifacts:
path: coverage

# Publish all packages to NPM
create-release:
executor: default
steps:
- checkout
- *attach-workspace
- run:
name: Publish to NPM
command: yarn auto shipit

# --- Workflow definitions --------------------------------------------------- #

workflows:

# Builds modules, verifies code with the linter, runs unit tests, and builds a
# coverage report.
pull-request:
jobs:
- install-dependencies
- install-dependencies: *filter-default-branches

- lint:
- build:
requires:
- install-dependencies

- test:
requires:
- build

- lint:
requires:
- build

# Builds modules, verifies code with the linter, runs unit tests, and
# publishes the built packages to NPM.
publish-to-npm:
jobs:
- install-dependencies: *filter-release-branches-only

- build:
requires:
- lint
- install-dependencies

- test:
requires:
- build

- lint:
requires:
- build

# Manual approval step as a final gatekeeper to prevent
# possible mistakes!
- confirm-release:
type: approval
requires:
- test
- lint

- create-release:
requires:
- confirm-release
- test
- lint
15 changes: 5 additions & 10 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@

[Provide a general summary of the pull request here.]

### 🗜 Versioning

(Check _one!_)

- [ ] Patch: Bug Fix?
- [ ] Minor: New Feature?
- [ ] Major: Breaking Change?

### ✅ Fixed Issues

- [List any fixed issues here like: Fixes #XXXX]
Expand All @@ -18,6 +10,9 @@

[Describe any additional context required to test the PR/feature/bug fix.]

### ⚠️ Update `CHANGELOG.md`
### ⚠️ Don't forget to add a [semver](https://semver.org/) label!

- [ ] I have updated the `Upcoming Changes` section of `CHANGELOG.md` with context related to this Pull Request.
- `patch`: Bug Fix?
- `minor`: New Feature?
- `major`: Breaking Change?
- `skip-release`: It's unnecessary to publish this change.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ package-lock.json
# Test artifacts
/coverage
/.nyc_output

# ENV
.env
8 changes: 6 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ Please note we have a **code of conduct**, please follow it in all your interact

## Opening a Pull Request

1. Update the **`Upcoming Changes`** section of [`CHANGELOG.md`](./CHANGELOG.md) with your fixes, changes, or additions. A maintainer will label your changes with a version number and release date once they are published.
2. Open a pull request from your fork/branch to the upstream `master` branch of _this_ repository.
1. Open a pull request from your fork/branch to the upstream `master` branch of _this_ repository.
2. Add a label for the [semver](https://semver.org/) update corresponding to your changes: `patch`, `minor`, or `major`.
3. A maintainer will review your code changes and offer feedback or suggestions if necessary. Once your changes are approved, a maintainer will merge the pull request for you and publish a release.

## Cutting a release

We use [`auto`](https://github.com/intuit/auto) as our continous delivery tool. Cutting a release is just a matter of merging to `master`. For pre-releases, you can create a `next` branch as the base for your experimental/W.I.P. feature. Please familiarize yourself with the [documentation for `auto`](https://intuit.github.io/auto/docs) if you are in a position to cut a release.

## Contributor Covenant Code of Conduct

### Our Pledge
Expand Down
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
"name": "@magic-sdk/admin",
"version": "1.2.2",
"description": "Magic Authentication Admin Javascript SDK.",
"author": "Fortmatic <team@fortmatic.com> (https://fortmatic.com/)",
"author": "Magic Labs <team@magic.link>",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/fortmatic/magic-admin-js"
},
"repository": "magiclabs/magic-admin-js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
Expand All @@ -33,6 +30,7 @@
"@types/node-fetch": "^2.5.4",
"@types/sinon": "^7.5.2",
"@typescript-eslint/eslint-plugin": "^2.15.0",
"auto": "^9.60.1",
"ava": "^3.4.0",
"cli-glob": "^0.1.0",
"eslint": "^6.7.2",
Expand Down Expand Up @@ -67,6 +65,12 @@
"lint-staged": {
"*.{ts,tsx}": "eslint --fix"
},
"auto": {
"plugins": [
"npm",
"released"
]
},
"ava": {
"require": [
"ts-node/register"
Expand Down
Loading

0 comments on commit bc4bc51

Please sign in to comment.