Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash -ex
- # Tries to download latest cached node_modules based on package-lock.json
- # If it can't, then `npm ci` and push up node_modules to cache
- # Assumes S3_BUCKET env var has been set, and that `aws` credentials
- # are configured (either in env, or ~/.aws/credentials)
- CHECKSUM=$(sha256sum package-lock.json | awk '{print $1}')
- if ! aws s3 cp s3://${S3_BUCKET}/cache/${CHECKSUM}.tgz - | tar -xz; then
- npm ci
- tar -cz node_modules | aws s3 cp - s3://${S3_BUCKET}/cache/${CHECKSUM}.tgz
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement