-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add automated versioning and deployment (#10)
- Loading branch information
1 parent
796f383
commit 5b6af1f
Showing
1 changed file
with
32 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,39 @@ | ||
language: node_js | ||
services: | ||
- docker | ||
node_js: | ||
- 10 | ||
cache: npm | ||
cache: | ||
directories: | ||
- node_modules | ||
env: | ||
- DOCKER_IMAGE="emakinatr/makina-app" | ||
script: | ||
# Build and test | ||
- npm run lint | ||
- npm run build | ||
- npm test | ||
after_script: | ||
# Coverage | ||
- npm install coveralls --no-save | ||
- coveralls < ./coverage/lcov.info | ||
# Deploy | ||
- | | ||
# Upload coverage to coveralls | ||
npm install --save-dev coveralls | ||
coveralls < ./coverage/lcov.info | ||
if [[ $TRAVIS_PULL_REQUEST == "false" && ($TRAVIS_BRANCH == "master" || $TRAVIS_BRANCH == "develop" || $TRAVIS_BRANCH == "feature/automated-versioning") ]]; then | ||
VERSION_TYPE=patch && [[ $TRAVIS_BRANCH == "master" ]] && VERSION_TYPE=minor | ||
echo $VERSION_TYPE | ||
VERSION=`npm version $VERSION_TYPE -m $'Release v%s\n\n[skip ci]'` | ||
echo $VERSION | ||
DOCKER_TAG=develop && [[ $TRAVIS_BRANCH == "master" ]] && DOCKER_TAG=latest | ||
echo $DOCKER_TAG | ||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | ||
docker pull $DOCKER_IMAGE:$DOCKER_TAG | ||
docker build -t $DOCKER_IMAGE:$VERSION -t $DOCKER_IMAGE:$DOCKER_TAG --cache-from $DOCKER_IMAGE:$DOCKER_TAG . | ||
docker push $DOCKER_IMAGE:$VERSION | ||
docker push $DOCKER_IMAGE:$DOCKER_TAG | ||
git remote rm origin | ||
git remote add origin https://${GITHUB_ACCESS_TOKEN}@github.com/EmakinaTR/makina-app.git | ||
git push origin HEAD:$TRAVIS_BRANCH | ||
git push origin --tags | ||
else | ||
echo "Skipping deploy for $TRAVIS_BRANCH." | ||
fi |