scratch-l10n/.circleci/config.yml

109 lines
2.8 KiB
YAML
Raw Normal View History

2020-05-12 12:42:14 -04:00
version: 2.1
orbs:
2020-05-12 15:32:10 -04:00
node: circleci/node@2.1.0
2020-05-13 12:35:53 -04:00
defaults: &defaults
working_directory: ~/project
executor:
name: node/default
tag: 'lts'
2020-05-12 12:42:14 -04:00
jobs:
build-and-test:
2020-05-13 12:35:53 -04:00
<<: *defaults
2020-05-12 12:42:14 -04:00
steps:
- checkout
2020-05-13 12:35:53 -04:00
- node/install-packages #node orb cmd caches
- run: npm run test
- persist_to_workspace:
root: ~/project
paths: .
deploy-npm:
<<: *defaults
steps:
- attach_workspace:
at: ~/project
- add_ssh_keys:
fingerprints:
- "58:62:ab:1f:24:b9:39:5a:ee:8a:e7:28:b2:f2:61:a2"
- run: ssh-keyscan -H github.com >> ~/.ssh/known_hosts
2020-05-13 12:35:53 -04:00
- run:
name: "configure release version"
2020-05-13 12:35:53 -04:00
command: |
VPKG=$($(npm bin)/json -f package.json version)
echo "export VERSION=${VPKG/%?/}$(date +%Y%m%d%H%M%S)" >> $BASH_ENV
- run:
name: "publish"
command: |
npm --no-git-tag-version version $VERSION
2020-05-13 12:35:53 -04:00
npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
npm publish
- run:
name: "tag release"
command: |
git tag $VERSION
git push $CIRCLE_REPOSITORY_URL $VERSION
2020-05-13 15:22:50 -04:00
pull-translations:
<<: *defaults
steps:
- checkout
- run:
name: "pull editor and www translations"
command: |
npm run pull:editor
npm run pull:www
npm run test
- persist_to_workspace:
root: ~/project
paths: .
commit-translations:
<<: *defaults
steps:
- attach_workspace:
at: ~/project
- add_ssh_keys:
fingerprints:
- "58:62:ab:1f:24:b9:39:5a:ee:8a:e7:28:b2:f2:61:a2"
- run: ssh-keyscan -H github.com >> ~/.ssh/known_hosts
2020-05-13 15:22:50 -04:00
- run:
name: "commit translation updates"
command: |
git add .
git commit -m "pull new editor translations from Transifex"
git push $CIRCLE_REPOSITORY_URL HEAD:master
2020-05-13 15:34:15 -04:00
sync-help:
<<: *defaults
steps:
- checkout
- run: npm run sync:help
2020-05-12 12:42:14 -04:00
workflows:
2020-05-13 12:35:53 -04:00
version: 2
build-test-and-deploy:
jobs:
- build-and-test
- deploy-npm:
requires:
- build-and-test
filters:
branches:
only: master
2020-05-13 15:22:50 -04:00
weekly-tx-pull:
triggers:
- schedule: # weekly on Tuesdays at 8pm
cron: "0 20 * * 2"
filters:
branches:
only: master
jobs:
- pull-translations
- commit-translations:
requires:
- pull-translations # don't commit if there were errors
2020-05-13 15:34:15 -04:00
daily-help-update:
triggers:
- schedule: # daily at 11pm
cron: "0 23 * * *"
filters:
branches:
only: master
jobs:
- sync-help