Automate and switch to reviewed

* Add travis deploy step for cron job to update automatically.
* switch to reviewed translations
* make update script check for non-zero return codes from the update and test.
This commit is contained in:
chrisgarrity 2018-12-06 11:45:45 -05:00
parent 8802f277ad
commit 475aee4a65
5 changed files with 16 additions and 11 deletions

View file

@ -1,6 +1,6 @@
language: node_js language: node_js
node_js: node_js:
- 6 - 8
- node - node
cache: cache:
directories: directories:
@ -9,16 +9,23 @@ jobs:
include: include:
- stage: npm release - stage: npm release
if: branch = master OR branch = npm-publish if: branch = master OR branch = npm-publish
node_js: 6 node_js: 8
script: npm run build script: npm run build
before_deploy: before_deploy:
- VPKG=$($(npm bin)/json -f package.json version) - VPKG=$($(npm bin)/json -f package.json version)
- export VERSION=${VPKG/%?/}$(date +%Y%m%d%H%M%S) - export VERSION=${VPKG/%?/}$(date +%Y%m%d%H%M%S)
- npm --no-git-tag-version version $VERSION - npm --no-git-tag-version version $VERSION
deploy: deploy:
provider: npm - provider: script
skip_cleanup: true
script: npm run update
on:
branch: master
condition: $TRAVIS_EVENT_TYPE == cron
- provider: npm
skip_cleanup: true skip_cleanup: true
email: $NPM_EMAIL email: $NPM_EMAIL
api_key: $NPM_TOKEN api_key: $NPM_TOKEN
on: on:
all_branches: true all_branches: true
condition: $TRAVIS_EVENT_TYPE != cron

View file

@ -21,6 +21,7 @@
"pull:blocks": "babel-node scripts/tx-pull-blocks ./editor/blocks/", "pull:blocks": "babel-node scripts/tx-pull-blocks ./editor/blocks/",
"pull:editor": "npm run pull:blocks && npm run pull:extensions && npm run pull:paint && npm run pull:interface", "pull:editor": "npm run pull:blocks && npm run pull:extensions && npm run pull:paint && npm run pull:interface",
"test": "npm run lint:js && npm run validate:editor && npm run build && npm run lint:json", "test": "npm run lint:js && npm run validate:editor && npm run build && npm run lint:json",
"update": "scripts/update-translations.sh",
"validate:blocks": "babel-node scripts/validate-translations ./editor/blocks/", "validate:blocks": "babel-node scripts/validate-translations ./editor/blocks/",
"validate:extensions": "babel-node scripts/validate-translations ./editor/extensions/", "validate:extensions": "babel-node scripts/validate-translations ./editor/extensions/",
"validate:interface": "babel-node scripts/validate-translations ./editor/interface/", "validate:interface": "babel-node scripts/validate-translations ./editor/interface/",

View file

@ -33,8 +33,7 @@ import locales, {localeMap} from '../src/supported-locales.js';
const PROJECT = 'scratch-editor'; const PROJECT = 'scratch-editor';
const RESOURCE = 'blocks'; const RESOURCE = 'blocks';
const OUTPUT_DIR = path.resolve(args[0]); const OUTPUT_DIR = path.resolve(args[0]);
// TODO: convert mode to 'reviewed' before January const MODE = {mode: 'reviewed'};
const MODE = {mode: 'default'};
const CONCURRENCY_LIMIT = 4; const CONCURRENCY_LIMIT = 4;
const TX = new transifex({ const TX = new transifex({

View file

@ -36,8 +36,7 @@ import locales, {localeMap} from '../src/supported-locales.js';
const PROJECT = args[0]; const PROJECT = args[0];
const RESOURCE = args[1]; const RESOURCE = args[1];
const OUTPUT_DIR = path.resolve(args[2]); const OUTPUT_DIR = path.resolve(args[2]);
// TODO: convert mode to 'reviewed' before January const MODE = {mode: 'reviewed'};
const MODE = {mode: 'default'};
const CONCURRENCY_LIMIT = 4; const CONCURRENCY_LIMIT = 4;
const TX = new transifex({ const TX = new transifex({

7
scripts/update-translations.sh Normal file → Executable file
View file

@ -1,13 +1,12 @@
#!/bin/bash #!/bin/bash
# script for syncing translations from transifex and comitting the changes. # script for syncing translations from transifex and comitting the changes.
# exit if either the pulls or the test fail
git checkout master
npm run pull:editor npm run pull:editor
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
npm run test npm run test
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
git add . git add .
git commit -m "pull new editor translations from Transifex" git commit -m "pull new editor translations from Transifex"