diff --git a/.travis.yml b/.travis.yml index e69de29b..088da212 100644 --- a/.travis.yml +++ b/.travis.yml @@ -0,0 +1,9 @@ +language: java +sudo: true +matrix: + include: + # Build the project using maven + - script: + - mvn install + # Deploy PR to surge + - script: bash ./surge_deploy.sh diff --git a/scripts/surge_deploy.sh b/scripts/surge_deploy.sh new file mode 100644 index 00000000..5ae8e96a --- /dev/null +++ b/scripts/surge_deploy.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then + echo "Not a PR. Skipping surge deployment" + exit 0 +fi +# Check if the travis credentials exists +if [ -z "$SURGE_LOGIN" ] || [ -z "$SURGE_TOKEN" ]; then + echo "Surge credentials not set. Skipping surge deployment" + exit 0 +fi +# Install surge +npm i -g surge +cd src/main/webapp +# Create a domain to the PR +export DEPLOY_DOMAIN=https://pr-${TRAVIS_PULL_REQUEST}-sef-site.surge.sh +# Upload to surge.sh +surge --project ./build --domain $DEPLOY_DOMAIN;