Skip to content

Commit

Permalink
ci: add GH Pages deploy and the i18n cron job
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cwillisf committed Jun 7, 2022
1 parent 52252bd commit 8263893
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 23 deletions.
74 changes: 53 additions & 21 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,69 @@
version: 2.1
orbs:
node: circleci/node@5
aliases:
- &release-branches
- develop
- /^hotfix\//
commands:
deploy_gh_pages:
steps:
- run:
name: deploy to GH Pages
command: |
if [ -n "$GH_PAGES_REPO" ]; then
export GIT_AUTHOR_EMAIL="$(git log --pretty=format:"%ae" -n1)"
export GIT_AUTHOR_NAME="$(git log --pretty=format:"%an" -n1)"
export GIT_COMMITTER_EMAIL="${GIT_AUTHOR_EMAIL}"
export GIT_COMMITTER_NAME="${GIT_AUTHOR_NAME}"
npm run deploy -x -r $GH_PAGES_REPO
fi
jobs:
branch-job:
build_no_release:
executor: node/default # defaults to LTS
steps:
- checkout
- node/install-packages
- run: npm test
- run: npx commitlint --from=`git merge-base HEAD develop`
- run: npm run build
- deploy_gh_pages
build_and_release:
executor: node/default # defaults to LTS
steps:
- checkout
- node/install-packages
- run: npm test
- run: npx commitlint --from=`git merge-base HEAD develop`
- run: npm run build
release-job:
- checkout
- node/install-packages
- run: npm test
- run: npx commitlint --from='HEAD~1'
- run: npm run build
- deploy_gh_pages
- run: npx semantic-release
update_i18n:
executor: node/default # defaults to LTS
steps:
- checkout
- node/install-packages
- run: npm test
- run: npx commitlint --from='HEAD~1'
- run: npm run build
- run: npx semantic-release
- checkout
- node/install-packages
- run: npm run i18n:src && npm run i18n:push
workflows:
version: 2
branch-workflow:
build_no_release:
jobs:
- build_no_release:
filters:
branches:
ignore: *release-branches
build_and_release:
jobs:
- branch-job:
- build_and_release:
filters:
branches:
ignore:
- develop
release-workflow:
only: *release-branches
update_i18n:
jobs:
- release-job:
- update_i18n
triggers:
- schedule:
cron: 0 0 * * * # daily at midnight UTC = 7-8pm US Eastern
filters:
branches:
only:
- develop
only: develop
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ trim_trailing_whitespace = true

[*.{js,html}]
indent_style = space

[.circleci/config.yml]
indent_size = 2
indent_style = space
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"scripts": {
"build": "npm run docs && webpack --progress --colors --bail",
"coverage": "tap ./test/{unit,integration}/*.js --coverage --coverage-report=lcov",
"deploy": "touch playground/.nojekyll && gh-pages -t -d playground -m \"Build for $(git log --pretty=format:%H -n1)\"",
"deploy": "touch playground/.nojekyll && gh-pages -t -d playground -m \"Build for $(git log -n1 --pretty=format:\"%h %s\") [skip ci]\"",
"docs": "jsdoc -c .jsdoc.json",
"i18n:src": "mkdirp translations/core && format-message extract --out-file translations/core/en.json src/extensions/**/index.js",
"i18n:push": "tx-push-src scratch-editor extensions translations/core/en.json",
Expand Down
11 changes: 10 additions & 1 deletion release.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
module.exports = {
extends: 'scratch-semantic-release-config',
branches: 'develop'
branches: [
{
name: 'develop'
// default channel
},
{
name: 'hotfix/*',
channel: 'hotfix'
}
]
};

0 comments on commit 8263893

Please sign in to comment.