Skip to content

Commit 22f85d9

Browse files
authored
Merge pull request #8513 from LLK/semantic-release
implement semantic-release and associated CI changes
2 parents d01ae67 + bbb97e2 commit 22f85d9

File tree

7 files changed

+12935
-8056
lines changed

7 files changed

+12935
-8056
lines changed

.circleci/config.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
version: 2.1
22
orbs:
3-
browser-tools: circleci/[email protected]
3+
browser-tools: circleci/[email protected]
4+
commitlint: conventional-changelog/[email protected]
5+
node: circleci/[email protected]
46
aliases:
57
- &save_git_cache
68
save_cache:
@@ -42,10 +44,12 @@ aliases:
4244
- v3-npm-
4345
- &defaults
4446
docker:
45-
- image: cimg/node:12.22.11-browsers
47+
# TODO: fix scratch-audio and change this to `cimg/node:lts-browsers`
48+
- image: cimg/node:14.20-browsers
4649
auth:
4750
username: $DOCKERHUB_USERNAME
4851
password: $DOCKERHUB_PASSWORD
52+
executor: node/default
4953
working_directory: ~/repo
5054

5155
jobs:
@@ -57,7 +61,7 @@ jobs:
5761
steps:
5862
- *restore_git_cache
5963
- checkout
60-
- run: npm ci
64+
- node/install-packages
6165
- run:
6266
name: Lint
6367
command: npm run test:lint -- --quiet --output-file test-results/eslint-results.xml --format junit
@@ -90,7 +94,7 @@ jobs:
9094
steps:
9195
- *restore_git_cache
9296
- checkout
93-
- run: npm ci
97+
- node/install-packages
9498
- *save_git_cache
9599
- *save_npm_cache
96100
lint:
@@ -173,27 +177,19 @@ jobs:
173177

174178
deploy-npm:
175179
<<: *defaults
176-
environment:
177-
NODE_OPTIONS: --max-old-space-size=4000
178180
steps:
179181
- *restore_git_cache
180-
- *restore_dist_cache
181182
- checkout
182-
- run: |
183-
echo export RELEASE_VERSION="0.1.0-prerelease.$(date +'%Y%m%d%H%M%S')" >> $BASH_ENV
184-
echo export NPM_TAG=latest >> $BASH_ENV
185-
if [ "$CIRCLE_BRANCH" == "master" ]
186-
then echo export NPM_TAG=stable >> $BASH_ENV
187-
fi
188-
if [[ "$CIRCLE_BRANCH" == hotfix/* ]] # double brackets are important for matching the wildcard
189-
then echo export NPM_TAG=hotfix >> $BASH_ENV
190-
fi
191-
- run: npm version --no-git-tag-version $RELEASE_VERSION
192-
- run: |
193-
npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
194-
npm publish --tag $NPM_TAG
195-
- run: git tag $RELEASE_VERSION
196-
- run: git push $CIRCLE_REPOSITORY_URL $RELEASE_VERSION
183+
- *restore_npm_cache
184+
- *restore_dist_cache
185+
- run:
186+
name: adjust config for hotfix if necessary
187+
command: |
188+
# double brackets are important for matching the wildcard
189+
if [[ "$CIRCLE_BRANCH" == hotfix/* ]]; then
190+
sed -e "s|hotfix/REPLACE|${CIRCLE_BRANCH}|" --in-place release.config.js
191+
fi
192+
- run: npx semantic-release
197193

198194
deploy-gh-pages:
199195
<<: *defaults
@@ -217,6 +213,10 @@ jobs:
217213

218214
workflows:
219215
version: 2
216+
commitlint:
217+
jobs:
218+
- commitlint/lint:
219+
target-branch: develop
220220
push-translations:
221221
triggers:
222222
- schedule:

.husky/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text eol=lf

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx --no-install commitlint --edit "$1"

commitlint.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
ignores: [message => message.startsWith('chore(release):')]
4+
};

0 commit comments

Comments
 (0)