SHARE
TWEET

Untitled

a guest Oct 17th, 2019 141 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top