You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ra...@apache.org on 2019/05/10 08:10:38 UTC

[cordova-docs] branch master updated: Faster PR builds & use Travis CI's deploy phase (#985)

This is an automated email from the ASF dual-hosted git repository.

raphinesse pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-docs.git


The following commit(s) were added to refs/heads/master by this push:
     new 3d40553  Faster PR builds & use Travis CI's deploy phase (#985)
3d40553 is described below

commit 3d40553a59bd121e0509a40b97e3ce4aef6347b8
Author: Raphael von der GrĂ¼n <ra...@gmail.com>
AuthorDate: Fri May 10 10:10:31 2019 +0200

    Faster PR builds & use Travis CI's deploy phase (#985)
    
    - Always run `npm test` during CI runs
    - Do a quick development build during `npm test`
    - Only run full production build before deployment
    - Replace `buildAndDeploy.sh` by `deploy.sh` which deploys an existing
      production build and is also usable outside of a Travis CI context
    - Unchanged: Only deploy on commits to master (not when checking PRs)
---
 .travis.yml         | 24 ++++++++++++++++--------
 buildAndDeploy.sh   | 18 ------------------
 package.json        |  2 +-
 tools/bin/deploy.sh | 24 ++++++++++++++++++++++++
 4 files changed, 41 insertions(+), 27 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 4a460e3..0e5246b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,12 +1,20 @@
 language: node_js
+node_js: 8
 sudo: false
-node_js:
-- '8'
-before_install:
-- bundle install
+
 install:
-- npm install
+  - npm install
+  - bundle install
+
 script:
-  - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
-  - chmod 755 buildAndDeploy.sh
-  - travis_wait 30 sleep infinity & ./buildAndDeploy.sh
+  - npm test
+
+before_deploy:
+  - travis_wait 30 npm run build
+
+deploy:
+  skip_cleanup: true
+  provider: script
+  script: bash tools/bin/deploy.sh
+  on:
+    branch: master
diff --git a/buildAndDeploy.sh b/buildAndDeploy.sh
deleted file mode 100755
index 66f16f9..0000000
--- a/buildAndDeploy.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-if [ $svn_pass ] && [ $BRANCH = "master" ]
-then
-    echo "### build, deploy, test: (branch = $BRANCH)"
-    npm run-script build;
-    cd ..;
-    svn checkout --non-interactive --no-auth-cache --username=$svn_username --password=$svn_pass https://svn.apache.org/repos/asf/cordova/site cordova-website;
-    cp -R cordova-docs/build-prod/. cordova-website/public/;
-    cd cordova-website || return;
-    svn status | grep "?";
-    svn add --force .;
-    svn --non-interactive --no-auth-cache --username=$svn_username --password=$svn_pass commit -m "Updated docs";
-    cd ../cordova-docs || return;
-    npm test;
-else
-    echo "### Build: (branch = $BRANCH)"
-    npm run build;
-fi
diff --git a/package.json b/package.json
index 3cf8014..98bb58f 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
     "doc": "doc"
   },
   "scripts": {
-    "test": "npm run eslint && npm run mocha",
+    "test": "npm run eslint && npm run mocha && gulp build",
     "mocha": "mocha --recursive tools/spec",
     "serve": "gulp serve --prod",
     "clean": "gulp clean",
diff --git a/tools/bin/deploy.sh b/tools/bin/deploy.sh
new file mode 100755
index 0000000..9156354
--- /dev/null
+++ b/tools/bin/deploy.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+set -e
+
+svn_url=https://svn.apache.org/repos/asf/cordova/site
+
+svn_q() { svn --quiet "$@" }
+
+svn_with_auth() {
+    [ $svn_username ] && [ $svn_pass ] || {
+        echo 'ERROR: No SVN credentials given in $svn_username and $svn_pass'
+        exit 1
+    }
+    svn_q --non-interactive --no-auth-cache \
+          --username="$svn_username" --password="$svn_pass" "$@"
+}
+
+echo "Deploying website and docs to $svn_url"
+cd ..
+svn_q checkout "$svn_url" cordova-website
+cp -R cordova-docs/build-prod/. cordova-website/public/
+cd cordova-website
+svn_q add --force .
+svn_with_auth commit -m "Updated docs"


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org