Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #!/bin/bash -ex
  2.  
  3. # Tries to download latest cached node_modules based on package-lock.json
  4. # If it can't, then `npm ci` and push up node_modules to cache
  5.  
  6. # Assumes S3_BUCKET env var has been set, and that `aws` credentials
  7. # are configured (either in env, or ~/.aws/credentials)
  8.  
  9. CHECKSUM=$(sha256sum package-lock.json | awk '{print $1}')
  10.  
  11. if ! aws s3 cp s3://${S3_BUCKET}/cache/${CHECKSUM}.tgz - | tar -xz; then
  12. npm ci
  13. tar -cz node_modules | aws s3 cp - s3://${S3_BUCKET}/cache/${CHECKSUM}.tgz
  14. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement