Skip to content

Instantly share code, notes, and snippets.

@adilsoncarvalho
Forked from mraible/gsutil-upload.sh
Created October 19, 2018 12:28
Show Gist options
  • Save adilsoncarvalho/f8cb15e1f6219ee1a13a935d1cc7bb4b to your computer and use it in GitHub Desktop.
Save adilsoncarvalho/f8cb15e1f6219ee1a13a935d1cc7bb4b to your computer and use it in GitHub Desktop.

Revisions

  1. @mraible mraible revised this gist Oct 7, 2015. No changes.
  2. @mraible mraible created this gist Oct 7, 2015.
    11 changes: 11 additions & 0 deletions gsutil-upload.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    # Rsync to remove old files
    gsutil -m rsync -x '.git*' -c -d -r dist gs://bucket/

    # Upload and gzip HTML, CSS and JavaScript
    gsutil -m cp -z "html,css,js" -r dist/** gs://bucket/

    # Set expires headers (6 months) on JS and CSS assets
    gsutil -m setmeta -h "Cache-Control: public, max-age=15552000" gs://bucket/assets/**

    # Make sure there's no expiration headers on HTML files
    gsutil -m setmeta -h "Content-Type:text/html" -h "Cache-Control:private, max-age=0, no-transform" gs://bucket/**/*.html