release-static-artifacts
npm module developed to support static site build in release phase. Each Heroku app release (v1
,v2
, etc.) gets its own bundle of static artifacts, based on the version number provided by Dyno Metadata:
- use in release phase to upload from
static-artifacts/
directory - use in startup script to download into
static-artifacts/
directory
Install
npm
Add the package to the app:
npm install @heroku/release-static-artifacts
yarn
For a Yarn-managed app:
yarn --registry="https://registry.npmjs.org" add @heroku/release-static-artifacts
Usage
# Enable the library (currently Review Apps & Heroku CI are not supported)
export STATIC_ARTIFACTS_ENABLED=true
# AWS IAM credentials
export STATIC_ARTIFACTS_AWS_ACCESS_KEY_ID=xxxxx
export STATIC_ARTIFACTS_AWS_SECRET_ACCESS_KEY=yyyyy
# AWS S3 bucket name
export STATIC_ARTIFACTS_BUCKET=test-bucket
export AWS_REGION=us-east-1
# In Heroku release script
npx release-static-artifacts-upload
# In Heroku dyno startup script (.profile)
npx release-static-artifacts-download