Static Hosting
We have tutorials to help you set up static hosting for various types of build outputs:
- Build Reports (tests, coverage, etc.)
- Images
- Videos
- Static Sites (like Swagger, Javadocs, etc.)
- Static Component Previews (like Storybook)
About the static_hosting
plugin
Sample task configuration:
---
version: 1
enabled: true
plugins:
static_hosting:
docs:
metadata:
name: Documentation
path: build/static-docs
Here, docs
is the user-chosen task id. This should be unique across all of the configured plugins.
The metadata
key can contain any information that you want to use for templating.
However, the name
key is optionally used by the default template to show the list of statically hosted build artifacts.
The docs
key contains the required path
. This path is specified from the root of the Git repository and can
either reference a file or a directory.
After Stoat aggregates build data to render the comment, something like this will be used for templating:
---
version: 1
enabled: true
plugins:
static_hosting:
docs:
metadata:
name: Documentation
path: build/static-docs
sha: "1848b03dd4b58c8f8485d51a2157af4904e4073f"
link: "https://some-path-here.stoat.page"
status: "✅"
As you can see, Stoat adds on some information that allows you to access the hosted artifact or view information about the build that produced the artifact. Note that all information in your metadata field will be passed through.
That means, in your comment template you can use any metadata value or value under the task id docs
to render the comment.
For example, the following template could be used to add a link to the file in the Stoat comment:
Or, if the uploaded file was an image that could be embedded, the following template could be used to render the image inline:
Default template
If you'd like to just get a table of all build outputs configured with the static_hosting
plugin, we recommend using:
Under the hood, this uses the following template:
Local previews
Our CLI can run static hosting using your local build results. View our local previews guide for more information.