Can you set Content-type="text/html" for file without extension?
Opened this issue · 3 comments
I want use URL like this "http://example.com/abc" instead of "http://example.com/abc.html",
Can you add an option to set Content-Type to text/html for files without extension?
I have a related problem... web assembly files (*.wasm extensions) need to use content-type application/wasm
to avoid error on Google Chrome, but the current type being used is binary/octet-stream
. Is there any way to replace the content-type of specific files?
looks like you can do that with the optional args flag
You can achieve this with the args
flag as @zmays mentioned. As an example:
- name: Deploy html files without extension and with content type
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete --include '*' --exclude '*.*' --content-type text/html
env:
AWS_S3_BUCKET: ${{ env.BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'eu-west-1'
This excludes all files with extension (something.some_extension), and upload all files without an extension (in this case, all files without the .html extension), and set the content-type to text/html for this files.
Since you can't upload all files with this content type (like js files), if you also want to upload all the other assets, you can upload all the files in another step and including all files with an extension:
- name: Deploy all files
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --include '*.*'
env:
AWS_S3_BUCKET: ${{ env.BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'eu-west-1'