Skip to content

Commit

Permalink
fix(ci): push built images images (siderolabs#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewrynhard authored Oct 19, 2018
1 parent e67dd43 commit f27917e
Showing 1 changed file with 10 additions and 35 deletions.
45 changes: 10 additions & 35 deletions .conform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,41 +34,16 @@ script:
set -e
# Only run if not a PR.
if [[ "${TRAVIS_PULL_REQUEST}" != "false" ]]; then
exit 0
fi
if [[ "${TRAVIS_BRANCH}" == "master" ]] || [[ ! -z "${TRAVIS_TAG}" ]]; then
# Check if working tree is clean.
if [[ "{{ .Git.IsClean }}" != "true" ]]; then
echo "The working tree is dirty."
git status
exit 1
fi
echo "Pushing image {{ .Docker.Image.Name }}:{{ .Docker.Image.Tag }}"
docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}"
docker push {{ .Docker.Image.Name }}:{{ .Docker.Image.Tag }}
docker tag {{ .Docker.Image.Name }}:{{ .Docker.Image.Tag }} {{ .Repository }}:latest
docker push {{ .Repository }}:latest
# Check if ref is a tag.
if [[ "{{ .Git.IsTag }}" != "true" ]]; then
exit 0
fi
# Check if the tag is a prerelease.
if [[ "{{ .Version.IsPrerelease }}" == "true" ]]; then
echo "Publishing prerelease {{ .Version.Major }}.{{ .Version.Minor }}.{{ .Version.Patch }}-{{ .Version.Prerelease }}"
docker tag {{ .Docker.Image.Name }}:{{ .Docker.Image.Tag }} {{ .Repository }}:{{ .Version.Major }}.{{ .Version.Minor }}.{{ .Version.Patch }}-{{ .Version.Prerelease }}
docker push {{ .Repository }}:{{ .Version.Major }}.{{ .Version.Minor }}.{{ .Version.Patch }}-{{ .Version.Prerelease }}
else
echo "Publishing release {{ .Version.Major }}.{{ .Version.Minor }}.{{ .Version.Patch }}"
docker tag {{ .Docker.Image.Name }}:{{ .Docker.Image.Tag }} {{ .Repository }}:{{ .Version.Major }}.{{ .Version.Minor }}.{{ .Version.Patch }}
docker push {{ .Repository }}:{{ .Version.Major }}.{{ .Version.Minor }}.{{ .Version.Patch }}
fi
fi
{{ if and (.Git.IsClean) (or (.Git.IsTag) (eq .Git.Branch "master")) }}
docker login --username=$DOCKER_USERNAME --password=$DOCKER_PASSWORD
docker tag {{ .Docker.Image.Name }}:{{ .Docker.Image.Tag }} {{ .Docker.Image.Name }}:latest
docker push {{ .Docker.Image.Name }}:{{ .Docker.Image.Tag }}
docker push {{ .Docker.Image.Name }}:latest
{{ if .Git.IsTag }}
docker tag {{ .Docker.Image.Name }}:{{ .Docker.Image.Tag }} {{ .Docker.Image.Name }}:{{ .Version.Original }}
docker push {{ .Docker.Image.Name }}:{{ .Version.Original }}
{{ end }}
{{ end }}
pipeline:
stages:
- src
Expand Down

0 comments on commit f27917e

Please sign in to comment.