-
Notifications
You must be signed in to change notification settings - Fork 667
Storybook: Add manual deployment workflow #32356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,92 @@ | ||||||||||||||||||
| name: Storybook PR Preview (manual) | ||||||||||||||||||
|
|
||||||||||||||||||
| on: | ||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||
| inputs: | ||||||||||||||||||
| pr_number: | ||||||||||||||||||
| description: "Pull Request number" | ||||||||||||||||||
| required: true | ||||||||||||||||||
| type: string | ||||||||||||||||||
| action: | ||||||||||||||||||
| description: "What to do with the preview" | ||||||||||||||||||
| required: true | ||||||||||||||||||
| type: choice | ||||||||||||||||||
| options: | ||||||||||||||||||
| - deploy | ||||||||||||||||||
| - remove | ||||||||||||||||||
| default: deploy | ||||||||||||||||||
|
|
||||||||||||||||||
| permissions: | ||||||||||||||||||
| contents: write | ||||||||||||||||||
| pull-requests: write | ||||||||||||||||||
|
|
||||||||||||||||||
| concurrency: | ||||||||||||||||||
| group: storybook-preview-${{ inputs.pr_number }} | ||||||||||||||||||
| cancel-in-progress: true | ||||||||||||||||||
|
|
||||||||||||||||||
| env: | ||||||||||||||||||
| SOURCE_DIR: ./apps/react-storybook/storybook-static | ||||||||||||||||||
|
|
||||||||||||||||||
| jobs: | ||||||||||||||||||
| preview: | ||||||||||||||||||
| name: ${{ inputs.action }} Storybook preview for PR | ||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||
| timeout-minutes: 30 | ||||||||||||||||||
| environment: github-pages | ||||||||||||||||||
|
|
||||||||||||||||||
| steps: | ||||||||||||||||||
| - name: Checkout PR head commit | ||||||||||||||||||
| if: inputs.action == 'deploy' | ||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||
| with: | ||||||||||||||||||
| ref: refs/pull/${{ inputs.pr_number }}/head | ||||||||||||||||||
| fetch-depth: 1 | ||||||||||||||||||
|
|
||||||||||||||||||
| - name: Use Node.js | ||||||||||||||||||
| if: inputs.action == 'deploy' | ||||||||||||||||||
| uses: actions/setup-node@v4 | ||||||||||||||||||
| with: | ||||||||||||||||||
| node-version: "20" | ||||||||||||||||||
|
|
||||||||||||||||||
| - name: Setup pnpm | ||||||||||||||||||
| if: inputs.action == 'deploy' | ||||||||||||||||||
| uses: pnpm/action-setup@v4 | ||||||||||||||||||
| with: | ||||||||||||||||||
| run_install: false | ||||||||||||||||||
|
|
||||||||||||||||||
| - name: Get pnpm store directory | ||||||||||||||||||
| if: inputs.action == 'deploy' | ||||||||||||||||||
| shell: bash | ||||||||||||||||||
| run: | | ||||||||||||||||||
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||||||||||||||||||
|
|
||||||||||||||||||
| - name: Setup pnpm + nx cache | ||||||||||||||||||
| if: inputs.action == 'deploy' | ||||||||||||||||||
| uses: actions/cache@v4 | ||||||||||||||||||
| with: | ||||||||||||||||||
| path: | | ||||||||||||||||||
| ${{ env.STORE_PATH }} | ||||||||||||||||||
| .nx/cache | ||||||||||||||||||
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||||||||||||||||||
| restore-keys: | | ||||||||||||||||||
| ${{ runner.os }}-pnpm-store | ||||||||||||||||||
|
|
||||||||||||||||||
| - name: Install dependencies | ||||||||||||||||||
| if: inputs.action == 'deploy' | ||||||||||||||||||
| run: pnpm install --frozen-lockfile | ||||||||||||||||||
|
|
||||||||||||||||||
| - name: Build Storybook preview (static) | ||||||||||||||||||
| if: inputs.action == 'deploy' | ||||||||||||||||||
| run: | | ||||||||||||||||||
| pnpx nx build devextreme-react-storybook | ||||||||||||||||||
|
|
||||||||||||||||||
|
||||||||||||||||||
| - name: Checkout gh-pages for removal | |
| if: inputs.action == 'remove' | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: gh-pages | |
| fetch-depth: 1 |
Uh oh!
There was an error while loading. Please reload this page.