From 475aee4a65acebb542a5287c1dac53654ac96d46 Mon Sep 17 00:00:00 2001 From: chrisgarrity Date: Thu, 6 Dec 2018 11:45:45 -0500 Subject: [PATCH] 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. --- .travis.yml | 13 ++++++++++--- package.json | 1 + scripts/tx-pull-blocks.js | 3 +-- scripts/tx-pull-translations.js | 3 +-- scripts/update-translations.sh | 7 +++---- 5 files changed, 16 insertions(+), 11 deletions(-) mode change 100644 => 100755 scripts/update-translations.sh diff --git a/.travis.yml b/.travis.yml index 7f1bf1d7..a7605bec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: -- 6 +- 8 - node cache: directories: @@ -9,16 +9,23 @@ jobs: include: - stage: npm release if: branch = master OR branch = npm-publish - node_js: 6 + node_js: 8 script: npm run build before_deploy: - VPKG=$($(npm bin)/json -f package.json version) - export VERSION=${VPKG/%?/}$(date +%Y%m%d%H%M%S) - npm --no-git-tag-version version $VERSION 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 email: $NPM_EMAIL api_key: $NPM_TOKEN on: all_branches: true + condition: $TRAVIS_EVENT_TYPE != cron diff --git a/package.json b/package.json index 874f35f7..df977da2 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "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", "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:extensions": "babel-node scripts/validate-translations ./editor/extensions/", "validate:interface": "babel-node scripts/validate-translations ./editor/interface/", diff --git a/scripts/tx-pull-blocks.js b/scripts/tx-pull-blocks.js index 76197a11..91cece9a 100644 --- a/scripts/tx-pull-blocks.js +++ b/scripts/tx-pull-blocks.js @@ -33,8 +33,7 @@ import locales, {localeMap} from '../src/supported-locales.js'; const PROJECT = 'scratch-editor'; const RESOURCE = 'blocks'; const OUTPUT_DIR = path.resolve(args[0]); -// TODO: convert mode to 'reviewed' before January -const MODE = {mode: 'default'}; +const MODE = {mode: 'reviewed'}; const CONCURRENCY_LIMIT = 4; const TX = new transifex({ diff --git a/scripts/tx-pull-translations.js b/scripts/tx-pull-translations.js index cb03a850..7f87e43e 100644 --- a/scripts/tx-pull-translations.js +++ b/scripts/tx-pull-translations.js @@ -36,8 +36,7 @@ import locales, {localeMap} from '../src/supported-locales.js'; const PROJECT = args[0]; const RESOURCE = args[1]; const OUTPUT_DIR = path.resolve(args[2]); -// TODO: convert mode to 'reviewed' before January -const MODE = {mode: 'default'}; +const MODE = {mode: 'reviewed'}; const CONCURRENCY_LIMIT = 4; const TX = new transifex({ diff --git a/scripts/update-translations.sh b/scripts/update-translations.sh old mode 100644 new mode 100755 index 67e78b9f..4ed7b4c4 --- a/scripts/update-translations.sh +++ b/scripts/update-translations.sh @@ -1,13 +1,12 @@ #!/bin/bash # script for syncing translations from transifex and comitting the changes. - -git checkout master +# exit if either the pulls or the test fail npm run pull:editor - +rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi npm run test - +rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi git add . git commit -m "pull new editor translations from Transifex"