|
51 | 51 | outputs:
|
52 | 52 | docs-only: ${{ steps.filter.outputs.docs_count == steps.filter.outputs.all_count }}
|
53 | 53 | sh: ${{ steps.filter.outputs.sh }}
|
| 54 | + ts: ${{ steps.filter.outputs.ts }} |
54 | 55 | steps:
|
55 | 56 | - uses: actions/checkout@v3
|
56 | 57 | # For pull requests it's not necessary to checkout the code
|
|
66 | 67 | # - '.github/**'
|
67 | 68 | sh:
|
68 | 69 | - "**.sh"
|
| 70 | + ts: |
| 71 | + - "**.tsx?" |
| 72 | + - "**.jsx?" |
| 73 | + - "**.lock" |
| 74 | + - "**.json" |
69 | 75 | - id: debug
|
70 | 76 | run: |
|
71 | 77 | echo "${{ toJSON(steps.filter )}}"
|
@@ -623,3 +629,47 @@ jobs:
|
623 | 629 | DD_CATEGORY: e2e
|
624 | 630 | GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
625 | 631 | run: go run scripts/datadog-cireport/main.go site/test-results/junit.xml
|
| 632 | + chromatic: |
| 633 | + # REMARK: this is only used to build storybook and deploy it to Chromatic. |
| 634 | + runs-on: ubuntu-latest |
| 635 | + needs: |
| 636 | + - changes |
| 637 | + if: needs.changes.outputs.ts == 'true' |
| 638 | + steps: |
| 639 | + - uses: actions/checkout@v3 |
| 640 | + with: |
| 641 | + # Required by Chromatic for build-over-build history, otherwise we |
| 642 | + # only get 1 commit on shallow checkout. |
| 643 | + fetch-depth: 0 |
| 644 | + |
| 645 | + - name: Install dependencies |
| 646 | + run: cd site && yarn |
| 647 | + |
| 648 | + # This step is not meant for mainline because any detected changes to |
| 649 | + # storybook snapshots will require manual approval/review in order for |
| 650 | + # the check to pass. This is desired in PRs, but not in mainline. |
| 651 | + - name: Publish to Chromatic (non-mainline) |
| 652 | + if: github.ref != 'refs/heads/main' && github.repository_owner == 'coder' |
| 653 | + uses: chromaui/action@v1 |
| 654 | + with: |
| 655 | + buildScriptName: "storybook:build" |
| 656 | + exitOnceUploaded: true |
| 657 | + # Chromatic states its fine to make this token public. See: |
| 658 | + # https://www.chromatic.com/docs/github-actions#forked-repositories |
| 659 | + projectToken: 695c25b6cb65 |
| 660 | + workingDir: "./site" |
| 661 | + |
| 662 | + # This is a separate step for mainline only that auto accepts and changes |
| 663 | + # instead of holding CI up. Since we squash/merge, this is defensive to |
| 664 | + # avoid the same changeset from requiring review once squashed into |
| 665 | + # main. Chromatic is supposed to be able to detect that we use squash |
| 666 | + # commits, but it's good to be defensive in case, otherwise CI remains |
| 667 | + # infinitely "in progress" in mainline unless we re-review each build. |
| 668 | + - name: Publish to Chromatic (mainline) |
| 669 | + if: github.ref == 'refs/heads/main' && github.repository_owner == 'coder' |
| 670 | + uses: chromaui/action@v1 |
| 671 | + with: |
| 672 | + autoAcceptChanges: true |
| 673 | + buildScriptName: "storybook:build" |
| 674 | + projectToken: 695c25b6cb65 |
| 675 | + workingDir: "./site" |
0 commit comments