drone-plugins / drone-s3

Drone plugin for publishing artifacts to Amazon S3
http://plugins.drone.io/drone-plugins/drone-s3
Apache License 2.0
36 stars 64 forks source link

Set Content-Types #34

Closed roo-oliv closed 4 years ago

roo-oliv commented 7 years ago

drone-s3 plugin already attempts to match file extensions with their corresponding mimetypes. But it may be the case that one want to force a certain mimetype for a file extension.

This PR adds support for doing so:

  s3:
    acl: $$PLUGIN_ACL
    region: $$PLUGIN_REGION
    bucket: $$PLUGIN_BUCKET
    access_key: $$AWS_ACCESS_KEY
    secret_key: $$AWS_SECRET_KEY
    content_types: $$PLUGIN_CONTENT_TYPE
    source: $$PLUGIN_SOURCE
    target: $$PLUGIN_TARGET

content_type may be used like this:

    ...
    content_type:
      ".svg": image/svg+xml
      ".unorthodox-extension": image/svg+xml
    ...
tboerger commented 7 years ago

Maybe you should take a look at the StringMapFlag as it's used within https://github.com/drone-plugins/drone-s3-sync/blob/master/main.go#L59-L64 instead of the yaml marshaling.

tboerger commented 7 years ago

This looks much better. What do you think @bradrydzewski?

tboerger commented 4 years ago

Replaced by https://github.com/drone-plugins/drone-s3/pull/34 now. Thanks for your efforts!