diff --git a/.conform.yaml b/.conform.yaml index f4984cc5..133f87c5 100644 --- a/.conform.yaml +++ b/.conform.yaml @@ -26,36 +26,38 @@ script: set -e - if [[ "${TRAVIS_BRANCH}" != "master" ]] || [[ -z "${TRAVIS_TAG}" ]]; then + if [[ ! -z "${TRAVIS_PULL_REQUEST}" ]]; then exit 0 fi - # Check if working tree is clean. - if [[ "{{ .Git.IsClean }}" != "true" ]]; then - echo "The working tree is dirty." - exit 1 - 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." + exit 1 + fi - echo "Pushing image {{ .Docker.Image }}" - docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" - docker push {{ .Docker.Image }} + 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 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 }} {{ .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 }} {{ .Repository }}:{{ .Version.Major }}.{{ .Version.Minor }}.{{ .Version.Patch }} - docker push {{ .Repository }}:{{ .Version.Major }}.{{ .Version.Minor }}.{{ .Version.Patch }} - docker tag {{ .Docker.Image }} {{ .Repository }}:latest - docker push {{ .Repository }}:latest + # 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 }} {{ .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 }} {{ .Repository }}:{{ .Version.Major }}.{{ .Version.Minor }}.{{ .Version.Patch }} + docker push {{ .Repository }}:{{ .Version.Major }}.{{ .Version.Minor }}.{{ .Version.Patch }} + docker tag {{ .Docker.Image }} {{ .Repository }}:latest + docker push {{ .Repository }}:latest + fi fi pipeline: