Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ script:

after_success:
- docker images
- ./release.sh

deploy:
provider: script
skip_cleanup: true
script: ./deploy.sh
on:
tags: true
condition: $TRAVIS_TAG =~ ^v?[0-9]+\.[0-9]+\.[0-9]+$
19 changes: 5 additions & 14 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,11 @@ eval $(docker run --rm \
quay.io/keboola/developer-portal-cli-v2:latest \
ecr:get-login ${KBC_DEVELOPERPORTAL_VENDOR} ${KBC_DEVELOPERPORTAL_APP})

# Push to the repository
docker tag ${APP_IMAGE}:latest ${REPOSITORY}:${TRAVIS_TAG}
docker tag ${APP_IMAGE}:latest ${REPOSITORY}:latest
docker push ${REPOSITORY}:${TRAVIS_TAG}
docker push ${REPOSITORY}:latest

# Update the tag in Keboola Developer Portal -> Deploy to KBC
if echo ${TRAVIS_TAG} | grep -c '^v\?[0-9]\+\.[0-9]\+\.[0-9]\+$'
then
docker run --rm \
-e KBC_DEVELOPERPORTAL_USERNAME \
-e KBC_DEVELOPERPORTAL_PASSWORD \
quay.io/keboola/developer-portal-cli-v2:latest \
update-app-repository ${KBC_DEVELOPERPORTAL_VENDOR} ${KBC_DEVELOPERPORTAL_APP} ${TRAVIS_TAG} ecr ${REPOSITORY}
else
echo "Skipping deployment to KBC, tag ${TRAVIS_TAG} is not allowed."
fi
docker run --rm \
-e KBC_DEVELOPERPORTAL_USERNAME \
-e KBC_DEVELOPERPORTAL_PASSWORD \
quay.io/keboola/developer-portal-cli-v2:latest \
update-app-repository ${KBC_DEVELOPERPORTAL_VENDOR} ${KBC_DEVELOPERPORTAL_APP} ${TRAVIS_TAG} ecr ${REPOSITORY}
26 changes: 26 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
set -e

# Obtain the component repository and log in
docker pull quay.io/keboola/developer-portal-cli-v2:latest
export REPOSITORY=`docker run --rm \
-e KBC_DEVELOPERPORTAL_USERNAME \
-e KBC_DEVELOPERPORTAL_PASSWORD \
quay.io/keboola/developer-portal-cli-v2:latest \
ecr:get-repository ${KBC_DEVELOPERPORTAL_VENDOR} ${KBC_DEVELOPERPORTAL_APP}`
eval $(docker run --rm \
-e KBC_DEVELOPERPORTAL_USERNAME \
-e KBC_DEVELOPERPORTAL_PASSWORD \
quay.io/keboola/developer-portal-cli-v2:latest \
ecr:get-login ${KBC_DEVELOPERPORTAL_VENDOR} ${KBC_DEVELOPERPORTAL_APP})

# Push to the repository
if [[ ${TRAVIS_TAG} != "" ]]
then
docker tag ${APP_IMAGE}:latest ${REPOSITORY}:${TRAVIS_TAG}
docker push ${REPOSITORY}:${TRAVIS_TAG}
elif [[ ${TRAVIS_PULL_REQUEST} == "false" && ${TRAVIS_BRANCH} != "" ]]
then
docker tag ${APP_IMAGE}:latest ${REPOSITORY}:${TRAVIS_BRANCH}
docker push ${REPOSITORY}:${TRAVIS_BRANCH}
fi