def pubkey_upload
      unless File.exist?("#{$config['general']['app_cache']}/artifacts/#{$config['general']['gpg_signing_key']}.publickey")

        # GPG key does not exist locally, we therefore assume it's not in the S3
        # bucket either, so we should export out and upload. Technically this may
        # result in a few extra uploads (once for any new machine using Pupistry)
        # but it doesn't cause any issue and saves me writing more code ;-)

        $logger.info "Exporting GPG key #{$config['general']['gpg_signing_key']} and uploading to S3 bucket..."

        # If it doesn't exist on this machine, then we're a bit stuck!
        unless pubkey_exist?
          $logger.error "The public key #{$config['general']['gpg_signing_key']} does not exist on this system, so unable to export it out"
          return false
        end

        # Export out key
        unless system "gpg --export --armour 0x#{$config['general']['gpg_signing_key']} > #{$config['general']['app_cache']}/artifacts/#{$config['general']['gpg_signing_key']}.publickey"
          $logger.error 'A fault occured when trying to export the GPG key'
          return false
        end

        # Upload
        s3 = Pupistry::StorageAWS.new 'build'

        unless s3.upload "#{$config['general']['app_cache']}/artifacts/#{$config['general']['gpg_signing_key']}.publickey", "#{$config['general']['gpg_signing_key']}.publickey"
          $logger.error 'Unable to upload GPG key to S3 bucket'
          return false
        end

      end
    end
def pubkey_upload
      unless File.exist?("#{$config['general']['app_cache']}/artifacts/#{$config['general']['gpg_signing_key']}.publickey")

        # GPG key does not exist locally, we therefore assume it's not in the S3
        # bucket either, so we should export out and upload. Technically this may
        # result in a few extra uploads (once for any new machine using Pupistry)
        # but it doesn't cause any issue and saves me writing more code ;-)

        $logger.info "Exporting GPG key #{$config['general']['gpg_signing_key']} and uploading to S3 bucket..."

        # If it doesn't exist on this machine, then we're a bit stuck!
        unless pubkey_exist?
          $logger.error "The public key #{$config['general']['gpg_signing_key']} does not exist on this system, so unable to export it out"
          return false
        end

        # Export out key
        unless system "gpg --export --armour 0x#{$config['general']['gpg_signing_key']} > #{$config['general']['app_cache']}/artifacts/#{$config['general']['gpg_signing_key']}.publickey"
          $logger.error 'A fault occured when trying to export the GPG key'
          return false
        end

        # Upload
        s3 = Pupistry::StorageAWS.new 'build'

        unless s3.upload "#{$config['general']['app_cache']}/artifacts/#{$config['general']['gpg_signing_key']}.publickey", "#{$config['general']['gpg_signing_key']}.publickey"
          $logger.error 'Unable to upload GPG key to S3 bucket'
          return false
        end

      end
    end
Extract & upload the public key to the s3 bucket for other users