function getPublisher() {
  if (process.env.AWS_ACCESS_KEY === undefined) {
    throw new Error('AWS_ACCESS_KEY must be set');
  }
  if (process.env.AWS_SECRET_KEY === undefined) {
    throw new Error('AWS_SECRET_KEY must be set');
  }
  if (process.env.AWS_REGION === undefined) {
    throw new Error('AWS_REGION must be set');
  }
  if (process.env.S3_ASSETS_BUCKET === undefined) {
    throw new Error('S3_ASSETS_BUCKET must be set');
  }
  return awspublish.create({
    region: config.get('aws.region'),
    params: {
      Bucket: config.get('aws.assetsBucketName'),
    },
    credentials: {
      accessKeyId: config.get('aws.accessKey'),
      secretAccessKey: config.get('aws.secretKey'),
      signatureVersion: 'v3',
    },
  });
}
/*'])
    .pipe(filtered)
    .pipe(rename((p) => {
      if (semver.valid(version)) {
        p.dirname = `/${env}/v${version}/${p.dirname}`;
        return p.dirname;
      }
      p.dirname = `/${env}/${p.dirname}`;
      return p.dirname;
    }))
    .pipe(awspublish.gzip())
    .pipe(parallelize(publisher.publish(), 10))
    .pipe(publisher.cache())
    .pipe(awspublish.reporter());
}

// NO GZIP
// If version is provided, upload will be written to subdir, ie: /staging/v54x/
// Otherwise it is dumped into root directory, ie: /staging/
export function audio(version, cb) {
  if (!production && !staging) {
    throw new Error('Current NODE_ENV not supported');
  }
  const publisher = awspublish.create(config.get('s3'));
  const filtered = filter(['*