@@ -603,3 +603,45 @@ jobs:
603
603
DD_CATEGORY : e2e
604
604
GIT_COMMIT_MESSAGE : ${{ github.event.head_commit.message }}
605
605
run : go run scripts/datadog-cireport/main.go site/test-results/junit.xml
606
+ chromatic :
607
+ # REMARK: this is only used to build storybook and deploy it to Chromatic.
608
+ runs-on : ubuntu-latest
609
+
610
+ steps :
611
+ - uses : actions/checkout@v3
612
+ with :
613
+ # Required by Chromatic for build-over-build history, otherwise we
614
+ # only get 1 commit on shallow checkout.
615
+ fetch-depth : 0
616
+
617
+ - name : Install dependencies
618
+ run : cd site && yarn
619
+
620
+ # This step is not meant for mainline because any detected changes to
621
+ # storybook snapshots will require manual approval/review in order for
622
+ # the check to pass. This is desired in PRs, but not in mainline.
623
+ - name : Publish to Chromatic (non-mainline)
624
+ if : github.ref != 'refs/heads/main' && github.repository_owner == 'coder'
625
+ uses : chromaui/action@v1
626
+ with :
627
+ buildScriptName : " storybook:build"
628
+ exitOnceUploaded : true
629
+ # Chromatic states its fine to make this token public. See:
630
+ # https://www.chromatic.com/docs/github-actions#forked-repositories
631
+ projectToken : 695c25b6cb65
632
+ workingDir : " ./site"
633
+
634
+ # This is a separate step for mainline only that auto accepts and changes
635
+ # instead of holding CI up. Since we squash/merge, this is defensive to
636
+ # avoid the same changeset from requiring review once squashed into
637
+ # main. Chromatic is supposed to be able to detect that we use squash
638
+ # commits, but it's good to be defensive in case, otherwise CI remains
639
+ # infinitely "in progress" in mainline unless we re-review each build.
640
+ - name : Publish to Chromatic (mainline)
641
+ if : github.ref == 'refs/heads/main' && github.repository_owner == 'coder'
642
+ uses : chromaui/action@v1
643
+ with :
644
+ autoAcceptChanges : true
645
+ buildScriptName : " storybook:build"
646
+ projectToken : 695c25b6cb65
647
+ workingDir : " ./site"
0 commit comments