version: 2
jobs:
  build:
    docker:
      - image: ipfs/ci-websites
        environment:
#          DEBUG: "true"
    steps:
      - checkout
      - run:
          command: make build
      - persist_to_workspace:
          root: .
          paths:
            - public

  deploy:
    docker:
      - image: olizilla/ipfs-dns-deploy:1.1
        environment:
          DOMAIN: multiformats.io
          BUILD_DIR: public
    steps:
      - attach_workspace:
          at: /tmp/workspace
      - run:
          name: Deploy website to IPFS
          command: |
            pin_name="$DOMAIN build $CIRCLE_BUILD_NUMBER"
            
            hash=$(pin-to-cluster.sh "$pin_name" /tmp/workspace/$BUILD_DIR)

            echo "Website added to IPFS: https://ipfs.io/ipfs/$hash"

            # Update DNSlink for prod or dev domain
            if [ "$CIRCLE_BRANCH" == "master" ] ; then
              dnslink-dnsimple -d $DOMAIN -r _dnslink -l /ipfs/$hash
            fi
workflows:
  version: 2
  build-deploy:
    jobs:
      - build
      - deploy:
          context: ipfs-dns-deploy
          requires:
            - build

version: 2
jobs:
  build:
    docker:
      - image: ipfs/ci-websites
        environment:
#          DEBUG: "true"
    steps:
      - checkout
      - run:
          command: make build
      - persist_to_workspace:
          root: .
          paths:
            - public

  deploy:
    docker:
      - image: olizilla/ipfs-dns-deploy:latest
        environment:
          DOMAIN: multiformats.io
          BUILD_DIR: public
    steps:
      - attach_workspace:
          at: /tmp/workspace
      - run:
          name: Deploy website to IPFS
          command: |
            pin_name="$DOMAIN build $CIRCLE_BUILD_NUMBER"
            
            hash=$(pin-to-cluster.sh "$pin_name" /tmp/workspace/$BUILD_DIR)

            echo "Website added to IPFS: https://ipfs.io/ipfs/$hash"

            # Update DNSlink for prod or dev domain
            if [ "$CIRCLE_BRANCH" == "master" ] ; then
              dnslink-dnsimple -d $DOMAIN -r _dnslink -l /ipfs/$hash
            fi
workflows:
  version: 2
  build-deploy:
    jobs:
      - build
      - deploy:
          context: ipfs-dns-deploy
          requires:
            - build

Use the right version of ipfs-deploy
Use the right version of ipfs-deploy
