From a591ea9212d0ec909e60b4686dd012afb38edf6b Mon Sep 17 00:00:00 2001 From: chrisgarrity Date: Fri, 7 Dec 2018 08:40:46 -0500 Subject: [PATCH] [WIP] conditions for cron job on travis --- .travis.yml | 14 +++++--------- scripts/update-translations.sh | 12 ++++++------ 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index a7605bec..0825ce1f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,11 @@ cache: - node_modules jobs: include: + - stage: update translations + if: $TRAVIS_EVENT_TYPE == cron + script: ./scripts/update-translations.sh - stage: npm release - if: branch = master OR branch = npm-publish + if: (branch = master OR branch = npm-publish) AND $TRAVIS_EVENT_TYPE != cron node_js: 8 script: npm run build before_deploy: @@ -16,16 +19,9 @@ jobs: - export VERSION=${VPKG/%?/}$(date +%Y%m%d%H%M%S) - npm --no-git-tag-version version $VERSION deploy: - - provider: script - skip_cleanup: true - script: npm run update - on: - branch: master - condition: $TRAVIS_EVENT_TYPE == cron - - provider: npm + provider: npm skip_cleanup: true email: $NPM_EMAIL api_key: $NPM_TOKEN on: all_branches: true - condition: $TRAVIS_EVENT_TYPE != cron diff --git a/scripts/update-translations.sh b/scripts/update-translations.sh index 2b1a16e5..7f876cbc 100755 --- a/scripts/update-translations.sh +++ b/scripts/update-translations.sh @@ -1,14 +1,14 @@ #!/bin/bash # script for syncing translations from transifex and comitting the changes. -# exit if either the pulls or the test fail + +# exit script if any command returns a non-zero return code: +set -ev npm run pull:editor -rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi #exit if pull failed -npm run test -rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi #exit if test failed +npm run test + +# commit any updates and push. Build and release should happen on the push not here. git add . - git commit -m "pull new editor translations from Transifex" - git push