Versioned API docs and assets on S3
The release workflow uses master, the existing HyperGAN release branch. It
publishes reviewed files to a new releases/<version>/ prefix. Keep the API
docs in hypergan-apidocs in us-east-1 and the assets in hypergan in
us-west-1. Each target uses a separate short-lived AWS role.
Prepare a release#
Build and qualify the package at the intended HyperGAN version. Check the
rendered API docs and links, or verify the intended downloadable assets and
their redistribution rights. Put the qualified public files in
release-assets/<api-docs|assets>/<version>/payload/. Add a neighboring
manifest.json that records the SHA-256, byte length, and MIME type of each
relative file. For API docs, include the text/html root index.html.
{
"files": {
"index.html": {
"sha256": "<sha256 of the reviewed file>",
"bytes": 42,
"content_type": "text/html"
}
}
}Open the package PR against develop. Checks validate the complete payload.
Publish it through the normal reviewed promotion to master. The workflow
reserves the version with the exact manifest, uses S3 conditional uploads, and
reads every object back anonymously to compare all bytes and MIME types.
It publishes the docs index after other files, and release.json after all
files pass. A failed attempt can resume with the same manifest and bytes.
Use a fresh version for a correction. Consumers can keep using the preceding
version URL during recovery.
Configure the production roles#
- Use the GitHub OIDC provider in the 255bits AWS account. Create one role for
hypergan-s3-api-docsand one forhypergan-s3-assets. Trust the exact GitHub OIDC subject for the named environment inHyperGAN/HyperGANand thests.amazonaws.comaudience. Restrict each environment tomasterand set itsAWS_S3_RELEASE_ROLE_ARNvariable to its exact role ARN. - Grant each role
s3:PutObjectonreleases/*in its own bucket only, withStringEqualsons3:if-none-matchset to*. The workflow requires neither delete permission nor object ACL changes. Add the publics3:GetObjectpolicy for this release prefix using the bucket's existing access controls. - Test the first reviewed version against both the new public
release.jsonand expected route or downloadable files. Check the legacy URLs as part of activation. IAM and bucket policies can be reverted independently of the immutable published bytes.