---
version: '3'

env:
  RELEASE_ANSIBLE:
    sh: |
      if [ '{{.REPOSITORY_TYPE}}' == 'ansible' ] && [ '{{.REPOSITORY_SUBTYPE}}' == 'role' ]; then
        echo 'release'
      fi
  RELEASE_DOCKER:
    sh: |
      if [ -f Dockerfile ] && ([ '{{.REPOSITORY_TYPE}}' == 'docker' ] || [ "$(jq -r '.blueprint.dockerPublish' package.json)" == 'true' ]); then
        echo 'release'
      fi
  RELEASE_GO:
    sh: |
      if [ '{{.REPOSITORY_TYPE}}' == 'go' ] && [ '{{.REPOSITORY_SUBTYPE}}' == 'cli' ]; then
        echo 'release'
      fi
  RELEASE_NPM:
    sh: |
      if [ '{{.REPOSITORY_TYPE}}' == 'npm' ] || [ "$(jq -r '.blueprint.npmPublish' package.json)" == 'true' ]; then
        echo 'release'
      fi
  RELEASE_PACKER:
    sh: |
      if [ '{{.REPOSITORY_TYPE}}' == 'packer' ]; then
        echo 'release'
      fi
  RELEASE_PYTHON:
    sh: |
      if [ '{{.REPOSITORY_TYPE}}' == 'python' ] || [ "$(jq -r '.blueprint.pythonPublish' package.json)" == 'true' ]; then
        echo 'release'
      fi

tasks:
  build:
    deps:
      - build:ansible
      - build:docker
      - build:go
      - build:npm
      - build:packer
      - build:python

  build:ansible:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_ANSIBLE" ]'

  build:docker:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_DOCKER" ]'

  build:go:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_GO" ]'

  build:npm:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_NPM" ]'

  build:packer:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_PACKER" ]'

  build:python:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_PYTHON" ]'

  prepare:
    deps:
      - prepare:ansible
      - prepare:docker
      - prepare:go
      - prepare:npm
      - prepare:packer
      - prepare:python

  prepare:ansible:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_ANSIBLE" ]'

  prepare:docker:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_DOCKER" ]'

  prepare:go:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_GO" ]'

  prepare:npm:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_NPM" ]'

  prepare:packer:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_PACKER" ]'

  prepare:python:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_PYTHON" ]'

  publish:
    deps:
      - publish:ansible
      - publish:docker
      - publish:go
      - publish:npm
      - publish:packer
      - publish:python

  publish:ansible:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_ANSIBLE" ]'

  publish:docker:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_DOCKER" ]'

  publish:go:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_GO" ]'

  publish:npm:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_NPM" ]'

  publish:packer:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_PACKER" ]'

  publish:python:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_PYTHON" ]'

  verify:
    deps:
      - verify:ansible
      - verify:docker
      - verify:go
      - verify:npm
      - verify:packer
      - verify:python

  verify:ansible:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_ANSIBLE" ]'

  verify:docker:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_DOCKER" ]'

  verify:go:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_GO" ]'

  verify:npm:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_NPM" ]'

  verify:packer:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_PACKER" ]'

  verify:python:
    cmds:
      - 'true'
    status:
      - '[ -z "$RELEASE_PYTHON" ]'
