From 507d693c8340d98a3685101cca46504d9c86c725 Mon Sep 17 00:00:00 2001 From: Adish M <44204658+adishM98@users.noreply.github.com> Date: Wed, 15 Apr 2026 11:50:27 +0530 Subject: [PATCH] Add GitHub Actions workflow for Storybook deployment This workflow automates the deployment of Storybook to Netlify upon pull request closure or manual trigger. --- .../workflows/storybook-netlify-deploy.yml | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/storybook-netlify-deploy.yml diff --git a/.github/workflows/storybook-netlify-deploy.yml b/.github/workflows/storybook-netlify-deploy.yml new file mode 100644 index 0000000000..9a92fccfe1 --- /dev/null +++ b/.github/workflows/storybook-netlify-deploy.yml @@ -0,0 +1,53 @@ +name: Deploy Storybook to Netlify + +on: + pull_request: + types: [closed] + branches: + - lts-3.16 + workflow_dispatch: + inputs: + branch: + description: "Branch to deploy" + required: true + default: "lts-3.16" + +jobs: + deploy-storybook: + if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || 'lts-3.16' }} + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "22.15.1" + cache: "npm" + cache-dependency-path: frontend/package-lock.json + + - name: Install dependencies + working-directory: frontend + run: npm ci + + - name: Build Storybook + working-directory: frontend + run: npx storybook build + + - name: Deploy to Netlify + uses: nwtgck/actions-netlify@v3 + with: + publish-dir: frontend/storybook-static + production-branch: lts-3.16 + production-deploy: ${{ github.event_name == 'pull_request' || inputs.branch == 'lts-3.16' }} + deploy-message: | + Storybook deploy from ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref_name }} @ ${{ github.sha }} + github-token: ${{ secrets.GITHUB_TOKEN }} + enable-commit-comment: false + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_STORYBOOK_SITE_ID }}