Setup travis ci deploy
* Deploy changes according to ops config * Use ops artifact bucket * Latest release as well as tagged releases * Latest master as well as per-build master * Make single reusable file
This commit is contained in:
Родитель
7294a37078
Коммит
5847fb221e
29
.travis.yml
29
.travis.yml
|
@ -1,27 +1,46 @@
|
|||
sudo: required
|
||||
|
||||
language: scala
|
||||
|
||||
jdk:
|
||||
- oraclejdk8
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages: # Required for docker build
|
||||
packages:
|
||||
- net-tools
|
||||
# These directories are cached to S3 at the end of the build
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.ivy2/cache
|
||||
- $HOME/.sbt/boot/
|
||||
- "$HOME/.ivy2/cache"
|
||||
- "$HOME/.sbt/boot/"
|
||||
|
||||
before_cache:
|
||||
# Tricks to avoid unnecessary cache updates
|
||||
- find $HOME/.ivy2 -name "ivydata-*.properties" -delete
|
||||
- find $HOME/.sbt -name "*.lock" -delete
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
scala:
|
||||
- 2.11.8
|
||||
|
||||
env:
|
||||
- DOCKER_DIR="../docker/"
|
||||
|
||||
script:
|
||||
- sbt ci
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
before_deploy:
|
||||
- export JAR="target/scala-2.11/telemetry-streaming-assembly-0.1-SNAPSHOT.jar"
|
||||
|
||||
deploy:
|
||||
- provider: script
|
||||
script: bash deploy.sh
|
||||
skip_cleanup: true
|
||||
on:
|
||||
repo: mozilla/telemetry-streaming
|
||||
all_branches: true
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ -z "$JAR" ]]; then
|
||||
echo "Missing arguments!" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TRAVIS_REPO_OWNER=${TRAVIS_REPO_SLUG%/*}
|
||||
SLUG=${TRAVIS_REPO_SLUG#*/}
|
||||
JAR_DIR="$TRAVIS_REPO_OWNER/$SLUG"
|
||||
JAR_NAME="$SLUG.jar"
|
||||
TXT_NAME="$SLUG.txt"
|
||||
|
||||
sbt assembly
|
||||
|
||||
if [[ -z "$TRAVIS_TAG" ]]; then
|
||||
BRANCH_OR_TAG=$TRAVIS_BRANCH
|
||||
ID=$TRAVIS_JOB_NUMBER
|
||||
else
|
||||
BRANCH_OR_TAG=tags
|
||||
ID=$TRAVIS_TAG
|
||||
fi
|
||||
|
||||
CANONICAL_JAR="$JAR_DIR/$BRANCH_OR_TAG/$ID/$JAR_NAME"
|
||||
echo $CANONICAL_JAR > $TXT_NAME
|
||||
|
||||
mkdir -p $JAR_DIR/$BRANCH_OR_TAG/$ID
|
||||
cp $JAR $CANONICAL_JAR
|
||||
cp $JAR "$JAR_DIR/$BRANCH_OR_TAG/$JAR_NAME"
|
||||
cp $TXT_NAME "$JAR_DIR/$BRANCH_OR_TAG/$TXT_NAME"
|
||||
|
||||
curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash
|
||||
|
||||
export ARTIFACTS_PERMISSIONS="public-read"
|
||||
export ARTIFACTS_PATHS="$TRAVIS_REPO_OWNER/"
|
||||
export ARTIFACTS_TARGET_PATHS="/$TRAVIS_REPO_OWNER/"
|
||||
artifacts upload
|
Загрузка…
Ссылка в новой задаче