Skip to content

Implemented workflow to deploy preview of pr changes #6

Implemented workflow to deploy preview of pr changes

Implemented workflow to deploy preview of pr changes #6

Workflow file for this run

name: Deploy PR previews
concurrency: preview-${{ github.ref }}
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
pages: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "16.19.0"
- name: Install Dependencies
run: yarn
- name: Filter the packages
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
react:
- 'packages/react/**'
ui-elements:
- 'packages/ui-elements/**'
- name: Create Build Directory
run: mkdir -p build/
- name: Build Storybook
if: steps.changes.outputs.react == 'true'
run: yarn build:storybook
working-directory: packages/react
- name: Prepare Build for Storybook
if: steps.changes.outputs.react == 'true'
run: mv -v packages/react/storybook-static/* build/
- name: Build UI-Elements
if: steps.changes.outputs.ui-elements == 'true'
run: yarn build:storybook
working-directory: packages/ui-elements
- name: Prepare Build for UI-Elements
if: steps.changes.outputs.ui-elements == 'true'
run: |
if [ -z "$(ls -A build/)" ]; then
mv -v packages/ui-elements/storybook-static/* build/
else
mkdir -p build/ui-elements
mv -v packages/ui-elements/storybook-static/* build/ui-elements/
fi
- uses: rossjrw/pr-preview-action@v1
with:
source-dir: build
preview-branch: gh-deploy
umbrella-dir: pulls
action: auto
- uses: rossjrw/pr-preview-action@v1
if: github.event.action == 'closed' || github.event.pull_request.merged == true
with:
source-dir: build
action: remove