This repository was archived by the owner on Jul 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathconfig.yml
More file actions
108 lines (105 loc) · 3.43 KB
/
config.yml
File metadata and controls
108 lines (105 loc) · 3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
version: 2.1
executors:
node-executor:
docker:
- image: circleci/node:12.17.0
working_directory: ~/app
jobs:
check_branch_name:
docker:
- image: circleci/node:12.17.0
working_directory: ~/app
steps:
- run:
name: fail if the branch name does not start with a valid prefix
command: |
branch=$CIRCLE_BRANCH
if [[ "$branch" =~ ^(dependabot|fix|feature|breaking)/ || "$branch" == 'master' ]]
then
echo $branch is a valid name
else
echo $branch is not valid because the branch name must match '^(dependabot|fix|feature|breaking)/' or be master
exit 1
fi
test:
executor: node-executor
steps:
- checkout
- run: yarn install --non-interactive
- run: yarn danger ci --failOnErrors
- run: yarn lint
- run: yarn test:coverage
- run: yarn build
- run: cd docs-www && yarn install --non-interactive && yarn build && cd ..
- persist_to_workspace:
root: ~/app
paths:
- .git
- node_modules
- coverage
publish_package:
executor: node-executor
steps:
- attach_workspace:
at: ~/app
- run: git checkout .
- run:
name: Generate coveralls config
command: "echo repo_token: $COVERALLS_REPO_TOKEN > ./.coveralls.yml"
- run:
name: Upload coverage to coveralls
command: cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
- run:
name: configure GitHub user
command: |
git config --global user.email "[email protected]"
git config --global user.name "DevOps Brainhub"
git remote -v
git remote remove origin
git remote add origin https://[email protected]/brainhubeu/react-file-input
git remote -v
git add .
git stash
- run:
name: bump NPM version
command: |
branch=`git log --oneline | grep '[0-9a-f]\{6,40\} Merge pull request #[0-9]\+ from brainhubeu/' | head -1 | sed 's@.* from brainhubeu/@@g' || true`
echo branch=$branch
if [[ "$branch" =~ ^(dependabot)/ ]]; then
npm version patch -m "%s [ci skip]"
elif [[ "$branch" =~ ^(fix)/ ]]; then
npm version patch -m "%s [ci skip]"
elif [[ "$branch" =~ ^(feature)/ ]]; then
npm version minor -m "%s [ci skip]"
elif [[ "$branch" =~ ^(breaking)/ ]]; then
npm version major -m "%s [ci skip]"
else
echo $branch is not valid because the branch name must match '^(dependabot|fix|feature|breaking)/'
exit 1
fi
- run: git pull --no-edit origin $CIRCLE_BRANCH
- run: git push origin $CIRCLE_BRANCH
- run:
name: npm publish
command: |
yarn build
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
npm publish
- run:
name: publish gh pages
command: ./tools/deploy-gh-pages.sh
workflows:
version: 2
lint_and_test_and_publish:
jobs:
- check_branch_name
- test:
requires:
- check_branch_name
- publish_package:
requires:
- test
filters:
branches:
only:
- master