Search code examples
azureazure-pipelinesstorybook

Publish storybook build to PR artifacts in Azure Pipeline


What I want to do: I want to get a preview of my storybook build inside the PR I'm working on.

I know I can use blob storage to host the build artifacts and publish a link to the html inside a PR comment.

I was wandering if there could be an option to upload the build artifacts to the PR itself (like you would with coverage report) and publish the link to the html in a PR comment?


Solution

  • I was wandering if there could be an option to upload the build artifacts to the PR itself (like you would with coverage report)

    Currently, Azure DevOps does not support hosting static web application. For code coverage reports you mentioned, Azure pipeline can visualize it as it is typically a standalone file or a set of files that include inline styles and scripts to display the coverage data. It doesn't require complex dependencies to render. But the HTML generated by storybook build often relies on additional assets like JavaScript, CSS, and images to render the interactive UI components.

    I noticed there are some extensions (PublishHTMLReports,Html Viewer )that can visualize HTML files, but from my testing, they can't visualize the storybook build result.

    Based on the current situation, I suggest you still publish your storybook to Azure blob storage. Or you can also consider other web hosts, such as GitHub Pages.