A deploy workflow plugin used by Electric Book projects and media repos with automated deploys to an Electric Book Server instance and S3 buckets.
Create .github/workflows/deploy.yml in your Electric Book project and/or media repo:
name: Deploy to Electric Book Server and S3
on:
push: # Trigger on any push, but branch validation will filter
workflow_dispatch: # Allow manual triggering
jobs:
deploy:
uses: electricbookworks/electric-book-deploy-workflow/.github/workflows/deploy.yml@{release-version}Replace {release-version} with the latest release (e.g. v2.0.2), unless you want to use an older version.
You can also add optional inputs to customise the Ruby and Node versions, as well as the config file location:
name: Deploy to Electric Book Server and S3
on:
push: # Trigger on any push, but branch validation will filter
workflow_dispatch: # Allow manual triggering
jobs:
deploy:
uses: electricbookworks/electric-book-deploy-workflow/.github/workflows/deploy.yml@{release-version}
with:
config-file: '.github/workflows/deploy.config.json' # optional - defaults to '.github/workflows/deploy.config.json'
node-version: '22' # optional - defaults to 22
ruby-version: '3.2' # optional - defaults to 3.2Create .github/workflows/deploy.config.json:
{
"book-server": {
"bucket-comment": "The bucket name is suffixed with -live or -staging depending on the branch.",
"bucket": "ebt-books",
"configs-comment": "All configs are relative to the _configs folder.",
"configs": ["_config.live.yml"],
"builds": [
{
"configs": [],
"dir": "electric-book"
},
{
"configs": ["_config.student.yml"],
"dir": "audience/student"
},
{
"configs": ["_config.teacher.yml"],
"dir": "audience/teacher"
}
]
},
"media" : {
"region": "eu-west-2",
"syncs": [
{
"bucket-comment": "The bucket name is suffixed with -live or -staging depending on the branch.",
"bucket": "ebt-media",
"source": "assets/images/web",
"destination": "assets/images/web",
"options": ""
}
]
},
"vercel": {
"trigger": {
"live": "https://api.vercel.com/v1/integrations/deploy/{IDs}",
"staging": "https://api.vercel.com/v1/integrations/deploy/{IDs}"
}
}
}In deploy.config.json configure the following:
- The S3 bucket to sync the built files to.
- Deployment configs to be used on all builds.
- The separate builds that need to be deployed. Each build has a deployment directory that will be uploaded to the S3 bucket. If the directory already exists, it will be replaced entirely by the new deployment. You can also configure build-specific configs for each.
- Media sync commands with S3.
- The Vercel deploy triggers. These are specific to the project and branch of the book server your project deploys to.