version: 2
jobs:
  build:
    # the image factory
    docker:
      - image: debian:stretch-slim
    steps:
      - run: apt-get -y update
      - run: apt-get -y install coreutils qemu gawk sed curl wget make git ssh gnupg2
      - run: echo 'deb http://download.virtualbox.org/virtualbox/debian stretch contrib' > /etc/apt/sources.list.d/virtualbox.list
      - run: wget https://www.virtualbox.org/download/oracle_vbox_2016.asc -O /tmp/oracle_vbox_2016.asc
      - run: apt-key add /tmp/oracle_vbox_2016.asc
      - run: apt-get -y update
      - run: apt-get -y install virtualbox-6.0
      - checkout
      - run: make debian-stretch
      - run: make ubuntu-bionic
      - run: make centos
      - run: make todist
      - store_artifacts:
          path: dist
  publish:
    # publishes the artificats to github
    docker:
      - image: debian:stretch-slim
    steps:
      - run: apt-get -y update
      - run: apt-get -y install unzip wget git ssh gnupg2 make
      - checkout
      - run: make install-ghr
      - run: make publish
workflows:
  version: 2
  build_and_publish:
    jobs:
      - build
      - publish:
          requires:
            - build
          filters:
            branches:
              only: master

version: 2
jobs:
  build:
    # the image factory
    docker:
      - image: debian:stretch-slim
    steps:
      - run:
          name: Install build dependencies
          command: |
            apt-get -y update
            apt-get -y install coreutils qemu gawk sed curl wget make git ssh gnupg2
      - run:
          name: Install VirtualBox
          command: |
            echo 'deb http://download.virtualbox.org/virtualbox/debian stretch contrib' > /etc/apt/sources.list.d/virtualbox.list
            wget https://www.virtualbox.org/download/oracle_vbox_2016.asc -O /tmp/oracle_vbox_2016.asc
            apt-key add /tmp/oracle_vbox_2016.asc
            apt-get -y update
            apt-get -y install virtualbox-6.0
      - checkout
      - run: make debian-stretch
      - run: make ubuntu-bionic
      - run: make centos
      - run: make todist
      - store_artifacts:
          path: dist
  publish:
    # publishes the artificats to github
    docker:
      - image: debian:stretch-slim
    steps:
      - attach_workspace:
          at: dist
      - run: apt-get -y update
      - run: apt-get -y install unzip wget git ssh gnupg2 make
      - checkout
      - run: make install-ghr
      - run:
          name: List dist folder
          command: ls -lahR ./dist/
      - run: make publish
workflows:
  version: 2
  build_and_publish:
    jobs:
      - build
      - publish:
          requires:
            - build
          filters:
            branches:
              only: master

Use names in build steps, attempt attaching workspace in publish job.
Use names in build steps, attempt attaching workspace in publish job.
