From 206041c24a3463c0bda4b020111d3942c26c9cd2 Mon Sep 17 00:00:00 2001 From: "Calum H. (IMB11)" Date: Fri, 27 Mar 2026 15:38:08 +0000 Subject: [PATCH 1/3] feat: use ci for storybook --- .github/workflows/frontend-preview.yml | 40 +++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/.github/workflows/frontend-preview.yml b/.github/workflows/frontend-preview.yml index eecd219f3d..c3194cc727 100644 --- a/.github/workflows/frontend-preview.yml +++ b/.github/workflows/frontend-preview.yml @@ -22,10 +22,47 @@ jobs: with: environment: ${{ matrix.environment }} + deploy-storybook: + if: github.repository_owner == 'modrinth' && github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + permissions: + contents: read + deployments: write + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + cache: pnpm + + - name: Install dependencies + working-directory: ./packages/ui + run: pnpm install + + - name: Build Storybook + working-directory: ./packages/ui + run: pnpm run build-storybook + + - name: Deploy Storybook preview + uses: cloudflare/wrangler-action@v3 + with: + apiToken: ${{ secrets.CF_API_TOKEN }} + accountId: ${{ secrets.CF_ACCOUNT_ID }} + workingDirectory: ./packages/ui + packageManager: pnpm + wranglerVersion: '4.54.0' + command: versions upload --preview-alias git-${{ github.sha }} + comment: if: github.repository_owner == 'modrinth' && github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest - needs: deploy + needs: [deploy, deploy-storybook] steps: - name: Download deployment URLs uses: actions/download-artifact@v7 @@ -70,4 +107,5 @@ jobs: |-------------|-----| | staging | ${{ steps.urls.outputs.staging-preview-url }} | | production | ${{ steps.urls.outputs.production-preview-url }} | + | storybook | https://git-${{ github.sha }}-storybook.modrinth.workers.dev | edit-mode: replace From 86347026f670fa9ab3be9581a53056e546aee0da Mon Sep 17 00:00:00 2001 From: "Calum H. (IMB11)" Date: Fri, 27 Mar 2026 15:39:03 +0000 Subject: [PATCH 2/3] feat: sha short --- .github/workflows/frontend-preview.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/frontend-preview.yml b/.github/workflows/frontend-preview.yml index c3194cc727..236e41eea4 100644 --- a/.github/workflows/frontend-preview.yml +++ b/.github/workflows/frontend-preview.yml @@ -49,6 +49,10 @@ jobs: working-directory: ./packages/ui run: pnpm run build-storybook + - name: Configure short SHA + id: meta + run: echo "sha_short=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT + - name: Deploy Storybook preview uses: cloudflare/wrangler-action@v3 with: @@ -57,7 +61,7 @@ jobs: workingDirectory: ./packages/ui packageManager: pnpm wranglerVersion: '4.54.0' - command: versions upload --preview-alias git-${{ github.sha }} + command: versions upload --preview-alias git-${{ steps.meta.outputs.sha_short }} comment: if: github.repository_owner == 'modrinth' && github.event.pull_request.head.repo.full_name == github.repository @@ -107,5 +111,5 @@ jobs: |-------------|-----| | staging | ${{ steps.urls.outputs.staging-preview-url }} | | production | ${{ steps.urls.outputs.production-preview-url }} | - | storybook | https://git-${{ github.sha }}-storybook.modrinth.workers.dev | + | storybook | https://git-${GITHUB_SHA::8}-storybook.modrinth.workers.dev | edit-mode: replace From a2ca09b5bfc0db3159d6638ead72c01ee1cb475e Mon Sep 17 00:00:00 2001 From: "Calum H. (IMB11)" Date: Fri, 27 Mar 2026 15:39:46 +0000 Subject: [PATCH 3/3] feat: storybook url --- .github/workflows/frontend-preview.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/frontend-preview.yml b/.github/workflows/frontend-preview.yml index 236e41eea4..d7ba1ad4ba 100644 --- a/.github/workflows/frontend-preview.yml +++ b/.github/workflows/frontend-preview.yml @@ -85,6 +85,7 @@ jobs: echo "staging-preview-url=$STAGING_PREVIEW_URL" >> $GITHUB_OUTPUT echo "production-preview-url=$PRODUCTION_PREVIEW_URL" >> $GITHUB_OUTPUT + echo "storybook-preview-url=https://git-${GITHUB_SHA::8}-storybook.modrinth.workers.dev" >> $GITHUB_OUTPUT - name: Find comment if: github.event_name == 'pull_request' @@ -111,5 +112,5 @@ jobs: |-------------|-----| | staging | ${{ steps.urls.outputs.staging-preview-url }} | | production | ${{ steps.urls.outputs.production-preview-url }} | - | storybook | https://git-${GITHUB_SHA::8}-storybook.modrinth.workers.dev | + | storybook | ${{ steps.urls.outputs.storybook-preview-url }} | edit-mode: replace