diff --git a/.github/workflows/shared-component-storybook-netlify.yaml b/.github/workflows/shared-component-storybook-netlify.yaml new file mode 100644 index 0000000000..ae0e2c1550 --- /dev/null +++ b/.github/workflows/shared-component-storybook-netlify.yaml @@ -0,0 +1,47 @@ +# Triggers after the shared component storybook has finished building, +# taking the artifact and uploading it to Netlify for easier viewing +name: Upload Shared Component Storybook to Netlify +on: + # Privilege escalation necessary to deploy to Netlify + # 🚨 We must not execute any checked out code here. + workflow_run: # zizmor: ignore[dangerous-triggers] + workflows: ["Build shared component storybook"] + types: + - completed + +concurrency: + group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch || github.run_id }} + cancel-in-progress: ${{ github.event.workflow_run.event == 'pull_request' }} + +permissions: {} + +jobs: + report: + if: github.event.workflow_run.conclusion != 'cancelled' && github.event.workflow_run.event == 'pull_request' + name: Upload Storybook + runs-on: ubuntu-24.04 + environment: Netlify + permissions: + actions: read + deployments: write + steps: + - name: 📥 Download artifact + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + name: shared-components-storybook + path: storybook-static + + - name: 📤 Deploy to Netlify + uses: matrix-org/netlify-pr-preview@9805cd123fc9a7e421e35340a05e1ebc5dee46b5 # v3 + with: + path: storybook-static + owner: ${{ github.event.workflow_run.head_repository.owner.login }} + branch: ${{ github.event.workflow_run.head_branch }} + revision: ${{ github.event.workflow_run.head_sha }} + token: ${{ secrets.NETLIFY_AUTH_TOKEN }} + site_id: ${{ vars.NETLIFY_SITE_ID }} + desc: Shared Component Storybook + deployment_env: SharedComponentStorybook + prefix: "storybook-"