Skip to content

Commit bc4bc51

Browse files
authored
Add continuous delivery via 'auto' package (#46)
* Add continuous delivery via 'auto' package * Update CONTRIBUTING and PR template * Update CircleCI 'pull-request' workflow order * Fix dependency-cache-key in CircleCI config
1 parent a187524 commit bc4bc51

File tree

6 files changed

+802
-46
lines changed

6 files changed

+802
-46
lines changed

.circleci/config.yml

+67-23
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
# ---------------------------------------------------------------------------- #
2-
# CI OVERVIEW #
3-
# ~~~~~~~~~~~ #
4-
# #
5-
# 1) The following scripts should be preserved in `package.json`: #
6-
# #
7-
# lint -- Run a linter against source files. #
8-
# build -- Build CJS and UMD bundles for the module. #
9-
# test -- Run unit tests and build a coverage report using #
10-
# Istanbul/`nyc`. #
11-
# #
12-
# #
13-
# 2) Ensure the aliases for `&dependency-paths` and `&build-output-paths` #
14-
# below properly reflect the dependency and output directories #
15-
# of the module. #
16-
# #
17-
# ---------------------------------------------------------------------------- #
18-
191
version: 2.1
202

213
# --- YAML Aliases ----------------------------------------------------------- #
@@ -34,7 +16,7 @@ aliases: [
3416
],
3517

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

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

@@ -43,6 +25,27 @@ aliases: [
4325
at: *workspace-root
4426
}
4527
},
28+
29+
# Filter pull requests not in "master" or "next" (development code)
30+
&filter-default-branches {
31+
filters: {
32+
branches: {
33+
ignore: "/^master$|^next$/"
34+
}
35+
}
36+
},
37+
38+
# Filter pull requests in "master" or "next" only (production code).
39+
&filter-release-branches-only {
40+
filters: {
41+
branches: {
42+
only: [
43+
"master",
44+
"next",
45+
]
46+
}
47+
}
48+
},
4649
]
4750

4851
# --- Executor definitions --------------------------------------------------- #
@@ -110,24 +113,65 @@ jobs:
110113
- store_artifacts:
111114
path: coverage
112115

116+
# Publish all packages to NPM
117+
create-release:
118+
executor: default
119+
steps:
120+
- checkout
121+
- *attach-workspace
122+
- run:
123+
name: Publish to NPM
124+
command: yarn auto shipit
125+
113126
# --- Workflow definitions --------------------------------------------------- #
114127

115128
workflows:
116-
117129
# Builds modules, verifies code with the linter, runs unit tests, and builds a
118130
# coverage report.
119131
pull-request:
120132
jobs:
121-
- install-dependencies
133+
- install-dependencies: *filter-default-branches
122134

123-
- lint:
135+
- build:
124136
requires:
125137
- install-dependencies
126138

139+
- test:
140+
requires:
141+
- build
142+
143+
- lint:
144+
requires:
145+
- build
146+
147+
# Builds modules, verifies code with the linter, runs unit tests, and
148+
# publishes the built packages to NPM.
149+
publish-to-npm:
150+
jobs:
151+
- install-dependencies: *filter-release-branches-only
152+
127153
- build:
128154
requires:
129-
- lint
155+
- install-dependencies
130156

131157
- test:
132158
requires:
159+
- build
160+
161+
- lint:
162+
requires:
163+
- build
164+
165+
# Manual approval step as a final gatekeeper to prevent
166+
# possible mistakes!
167+
- confirm-release:
168+
type: approval
169+
requires:
170+
- test
171+
- lint
172+
173+
- create-release:
174+
requires:
175+
- confirm-release
176+
- test
133177
- lint

.github/PULL_REQUEST_TEMPLATE.md

+5-10
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22

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

5-
### 🗜 Versioning
6-
7-
(Check _one!_)
8-
9-
- [ ] Patch: Bug Fix?
10-
- [ ] Minor: New Feature?
11-
- [ ] Major: Breaking Change?
12-
135
### ✅ Fixed Issues
146

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

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

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

23-
- [ ] I have updated the `Upcoming Changes` section of `CHANGELOG.md` with context related to this Pull Request.
15+
- `patch`: Bug Fix?
16+
- `minor`: New Feature?
17+
- `major`: Breaking Change?
18+
- `skip-release`: It's unnecessary to publish this change.

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ package-lock.json
1717
# Test artifacts
1818
/coverage
1919
/.nyc_output
20+
21+
# ENV
22+
.env

CONTRIBUTING.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@ Please note we have a **code of conduct**, please follow it in all your interact
1919

2020
## Opening a Pull Request
2121

22-
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.
23-
2. Open a pull request from your fork/branch to the upstream `master` branch of _this_ repository.
22+
1. Open a pull request from your fork/branch to the upstream `master` branch of _this_ repository.
23+
2. Add a label for the [semver](https://semver.org/) update corresponding to your changes: `patch`, `minor`, or `major`.
2424
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.
2525

26+
## Cutting a release
27+
28+
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.
29+
2630
## Contributor Covenant Code of Conduct
2731

2832
### Our Pledge

package.json

+9-5
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22
"name": "@magic-sdk/admin",
33
"version": "1.2.2",
44
"description": "Magic Authentication Admin Javascript SDK.",
5-
"author": "Fortmatic <team@fortmatic.com> (https://fortmatic.com/)",
5+
"author": "Magic Labs <team@magic.link>",
66
"license": "MIT",
7-
"repository": {
8-
"type": "git",
9-
"url": "https://github.com/fortmatic/magic-admin-js"
10-
},
7+
"repository": "magiclabs/magic-admin-js",
118
"main": "dist/index.js",
129
"types": "dist/index.d.ts",
1310
"files": [
@@ -33,6 +30,7 @@
3330
"@types/node-fetch": "^2.5.4",
3431
"@types/sinon": "^7.5.2",
3532
"@typescript-eslint/eslint-plugin": "^2.15.0",
33+
"auto": "^9.60.1",
3634
"ava": "^3.4.0",
3735
"cli-glob": "^0.1.0",
3836
"eslint": "^6.7.2",
@@ -67,6 +65,12 @@
6765
"lint-staged": {
6866
"*.{ts,tsx}": "eslint --fix"
6967
},
68+
"auto": {
69+
"plugins": [
70+
"npm",
71+
"released"
72+
]
73+
},
7074
"ava": {
7175
"require": [
7276
"ts-node/register"

0 commit comments

Comments
 (0)