Skip to content

Commit 80e0b7d

Browse files
author
Aaron Alaniz
authored
AHOYAPPS-429 Add release pipeline (#8)
1 parent 4ab3a21 commit 80e0b7d

File tree

5 files changed

+88
-18
lines changed

5 files changed

+88
-18
lines changed

.circleci/config.yml

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,75 @@
11
version: 2.1
2+
3+
workspace: &workspace
4+
~/plugin-rtc
5+
6+
node-defaults: &node-defaults
7+
working_directory: *workspace
8+
executor:
9+
name: node/default
10+
tag: 13.10.1
11+
12+
release-filter: &release-filter
13+
filters:
14+
tags:
15+
only: /^v.*/
16+
branches:
17+
ignore: /.*/
18+
219
orbs:
320
node: circleci/[email protected]
21+
422
jobs:
523
build-and-test:
6-
executor:
7-
name: node/default
24+
<<: *node-defaults
825
steps:
926
- checkout
1027
- node/with-cache:
1128
steps:
1229
- run: npm install
1330
- run: npm test -- -i --verbose
31+
- persist_to_workspace:
32+
root: .
33+
paths: .
34+
35+
publish-release:
36+
<<: *node-defaults
37+
steps:
38+
- checkout
39+
- attach_workspace:
40+
at: *workspace
41+
- node/with-cache:
42+
steps:
43+
- run:
44+
name: Validate release version
45+
command: |
46+
TAG=${CIRCLE_TAG:1}
47+
CURRENT_VERSION=$(node -p "require('./package.json').version")
48+
if [ "$TAG" == "$CURRENT_VERSION" ]; then
49+
echo "Release tag matches current version"
50+
else
51+
echo "Release tag does not match current version"
52+
exit 1
53+
fi
54+
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > $PWD/.npmrc
55+
- run: npm publish
56+
- run: echo 'export DEFAULT_BRANCH=$(git remote show origin | grep HEAD | cut -d ":" -f2- | xargs)' >> $BASH_ENV
57+
- run: git checkout $DEFAULT_BRANCH
58+
- run: npm --no-git-tag-version version patch
59+
- run: git add package.json package-lock.json
60+
- run: git commit -m "Bump version after release"
61+
- run: git push origin $DEFAULT_BRANCH
62+
1463
workflows:
1564
build-and-test:
1665
jobs:
17-
- build-and-test
66+
- build-and-test
67+
68+
publish-release:
69+
jobs:
70+
- build-and-test:
71+
<<: *release-filter
72+
- publish-release:
73+
<<: *release-filter
74+
requires:
75+
- build-and-test

.npmignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules/
2+
.prettierrc
3+
test/
4+
.vscode
5+
.circleci
6+
.github
7+
npm-debug.log
8+
jest.config.js

.vscode/launch.json

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,19 @@
66
"configurations": [
77
{
88
"type": "node",
9+
"name": "Jest Tests",
910
"request": "launch",
10-
"name": "Mocha Tests",
11-
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
11+
"env": {
12+
"TZ": "utc",
13+
},
14+
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
1215
"args": [
13-
"-u",
14-
"bdd",
15-
"--timeout",
16-
"999999",
17-
"--colors",
18-
"--recursive",
19-
"${workspaceFolder}/test"
16+
"--runInBand"
2017
],
21-
"internalConsoleOptions": "openOnSessionStart",
22-
"skipFiles": [
23-
"<node_internals>/**"
24-
]
18+
"cwd": "${workspaceFolder}",
19+
"console": "integratedTerminal",
20+
"internalConsoleOptions": "neverOpen",
21+
"disableOptimisticBPs": true
2522
},
2623
]
2724
}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
{
2-
"name": "plugin-rtc",
2+
"name": "@twilio-labs/plugin-rtc",
33
"version": "0.1.0",
44
"description": "A Twilio-CLI plugin for real-time communication apps",
55
"main": "index.js",
6+
"publishConfig": {
7+
"access": "public"
8+
},
9+
"repository": "twilio-labs/plugin-rtc",
610
"scripts": {
711
"test": "TZ=utc jest",
812
"postpack": "rm -f oclif.manifest.json",
@@ -73,6 +77,9 @@
7377
"rtc": {
7478
"description": "A plugin which showcases real-time communication applications powered by Twilio"
7579
},
80+
"rtc:apps": {
81+
"description": "Commands related to Programmable Voice and Video apps"
82+
},
7683
"rtc:apps:video": {
7784
"description": "Commands related to Programmable Video apps"
7885
},

0 commit comments

Comments
 (0)