Skip to content

Commit 8263893

Browse files
committed
ci: add GH Pages deploy and the i18n cron job
All non-cron builds deploy to GH Pages, but only release branches generate actual releases on npm / GH. Hotfix branches are considered release branches and should be released under the `hotfix` tag on npm.
1 parent 52252bd commit 8263893

File tree

4 files changed

+68
-23
lines changed

4 files changed

+68
-23
lines changed

Diff for: .circleci/config.yml

+53-21
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,69 @@
11
version: 2.1
22
orbs:
33
node: circleci/node@5
4+
aliases:
5+
- &release-branches
6+
- develop
7+
- /^hotfix\//
8+
commands:
9+
deploy_gh_pages:
10+
steps:
11+
- run:
12+
name: deploy to GH Pages
13+
command: |
14+
if [ -n "$GH_PAGES_REPO" ]; then
15+
export GIT_AUTHOR_EMAIL="$(git log --pretty=format:"%ae" -n1)"
16+
export GIT_AUTHOR_NAME="$(git log --pretty=format:"%an" -n1)"
17+
export GIT_COMMITTER_EMAIL="${GIT_AUTHOR_EMAIL}"
18+
export GIT_COMMITTER_NAME="${GIT_AUTHOR_NAME}"
19+
npm run deploy -x -r $GH_PAGES_REPO
20+
fi
421
jobs:
5-
branch-job:
22+
build_no_release:
23+
executor: node/default # defaults to LTS
24+
steps:
25+
- checkout
26+
- node/install-packages
27+
- run: npm test
28+
- run: npx commitlint --from=`git merge-base HEAD develop`
29+
- run: npm run build
30+
- deploy_gh_pages
31+
build_and_release:
632
executor: node/default # defaults to LTS
733
steps:
8-
- checkout
9-
- node/install-packages
10-
- run: npm test
11-
- run: npx commitlint --from=`git merge-base HEAD develop`
12-
- run: npm run build
13-
release-job:
34+
- checkout
35+
- node/install-packages
36+
- run: npm test
37+
- run: npx commitlint --from='HEAD~1'
38+
- run: npm run build
39+
- deploy_gh_pages
40+
- run: npx semantic-release
41+
update_i18n:
1442
executor: node/default # defaults to LTS
1543
steps:
16-
- checkout
17-
- node/install-packages
18-
- run: npm test
19-
- run: npx commitlint --from='HEAD~1'
20-
- run: npm run build
21-
- run: npx semantic-release
44+
- checkout
45+
- node/install-packages
46+
- run: npm run i18n:src && npm run i18n:push
2247
workflows:
2348
version: 2
24-
branch-workflow:
49+
build_no_release:
50+
jobs:
51+
- build_no_release:
52+
filters:
53+
branches:
54+
ignore: *release-branches
55+
build_and_release:
2556
jobs:
26-
- branch-job:
57+
- build_and_release:
2758
filters:
2859
branches:
29-
ignore:
30-
- develop
31-
release-workflow:
60+
only: *release-branches
61+
update_i18n:
3262
jobs:
33-
- release-job:
63+
- update_i18n
64+
triggers:
65+
- schedule:
66+
cron: 0 0 * * * # daily at midnight UTC = 7-8pm US Eastern
3467
filters:
3568
branches:
36-
only:
37-
- develop
69+
only: develop

Diff for: .editorconfig

+4
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ trim_trailing_whitespace = true
99

1010
[*.{js,html}]
1111
indent_style = space
12+
13+
[.circleci/config.yml]
14+
indent_size = 2
15+
indent_style = space

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"scripts": {
1515
"build": "npm run docs && webpack --progress --colors --bail",
1616
"coverage": "tap ./test/{unit,integration}/*.js --coverage --coverage-report=lcov",
17-
"deploy": "touch playground/.nojekyll && gh-pages -t -d playground -m \"Build for $(git log --pretty=format:%H -n1)\"",
17+
"deploy": "touch playground/.nojekyll && gh-pages -t -d playground -m \"Build for $(git log -n1 --pretty=format:\"%h %s\") [skip ci]\"",
1818
"docs": "jsdoc -c .jsdoc.json",
1919
"i18n:src": "mkdirp translations/core && format-message extract --out-file translations/core/en.json src/extensions/**/index.js",
2020
"i18n:push": "tx-push-src scratch-editor extensions translations/core/en.json",

Diff for: release.config.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
module.exports = {
22
extends: 'scratch-semantic-release-config',
3-
branches: 'develop'
3+
branches: [
4+
{
5+
name: 'develop'
6+
// default channel
7+
},
8+
{
9+
name: 'hotfix/*',
10+
channel: 'hotfix'
11+
}
12+
]
413
};

0 commit comments

Comments
 (0)