1
0
mirror of https://github.com/ansible/galaxy.git synced 2026-02-05 09:45:11 +01:00
Files
galaxy/scripts/travis-publish-image.sh
Ivan Remizov a10e56c6ea Add linter for shell scripts
This patch add linter for shell scripts.
It includes:
* Makefile target `dev/shellcheck`,
* checks for `scripts/**/*.sh`,
* corrections for code that did not pass shellcheck,
* travis integration.

Signed-off-by: Ivan Remizov <iremizov@gmail.com>
2018-07-16 11:39:19 +03:00

34 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
set -o xtrace
readonly GALAXY_VERSION_TAG="^v[0-9]"
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
echo "WARNING: Build trgiggered by pull request. Skipping docker image build."
exit 0
fi
if [[ "$TRAVIS_BRANCH" == "develop" ]]; then
docker tag galaxy:latest ansible/galaxy:develop
docker login --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD"
echo "Pushing docker image: ansible/galaxy:develop"
docker push ansible/galaxy:develop
elif [[ "$TRAVIS_TAG" =~ $GALAXY_VERSION_TAG ]]; then
# Strip 'v' prefix from git tag
IMAGE_TAG=${TRAVIS_TAG#v}
docker tag galaxy:latest "ansible/galaxy:$IMAGE_TAG"
docker tag galaxy:latest ansible/galaxy:latest
docker login --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD"
echo "Pushing docker image: ansible/galaxy:$IMAGE_TAG"
docker push "ansible/galaxy:$IMAGE_TAG"
echo "Updating ansible/galaxy:latest to ansible/galaxy:$IMAGE_TAG"
docker push ansible/galaxy:latest
else
echo "WARNING: Cannot publish image. Configuration not supported."
exit 0
fi