Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): update script to print useful information #23

Merged
merged 1 commit into from
Jul 22, 2017
Merged
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
8 changes: 8 additions & 0 deletions .conform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,34 @@ script:

set -e

# Check if the branch is a master.
if [[ "{{ .Git.Branch }}" != "master" ]]; then
echo "Branch '{{ .Git.Branch }}' is not 'master'"
exit 0
fi

# Check if working tree is clean.
if [[ "{{ .Git.IsClean }}" != "true" ]]; then
echo "The working tree is dirty."
exit 1
fi

echo "Pushing image {{ .Docker.Image }}"
docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}"
docker push {{ .Docker.Image }}

# Check if ref is a tag.
if [[ "{{ .Git.IsTag }}" != "true" ]]; then
exit 0
fi

# Check if tag is a prerelease.
if [[ "{{ .Version.IsPrerelease }}" == "true" ]]; then
echo "Prerelease {{ .Version.Major }}.{{ .Version.Minor }}.{{ .Version.Patch }}-{{ .Version.Prerelease }}"
docker tag {{ .Docker.Image }} {{ .Repository }}:{{ .Version.Major }}.{{ .Version.Minor }}.{{ .Version.Patch }}-{{ .Version.Prerelease }}
docker push {{ .Repository }}:{{ .Version.Major }}.{{ .Version.Minor }}.{{ .Version.Patch }}-{{ .Version.Prerelease }}
else
echo "Release {{ .Version.Major }}.{{ .Version.Minor }}.{{ .Version.Patch }}"
docker tag {{ .Docker.Image }} {{ .Repository }}:{{ .Version.Major }}.{{ .Version.Minor }}.{{ .Version.Patch }}
docker push {{ .Repository }}:{{ .Version.Major }}.{{ .Version.Minor }}.{{ .Version.Patch }}
docker tag {{ .Docker.Image }} {{ .Repository }}:latest
Expand Down