Field Base #2383
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build PR Storybooks | |
on: | |
pull_request: | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
outputs: | |
status: ${{ steps.check-updated-storybooks.outputs.any }} | |
steps: | |
- name: Check updated storybooks | |
uses: dorny/paths-filter@v2 | |
id: check-updated-storybooks | |
with: | |
filters: | | |
any: | |
- libs/** | |
core: | |
- libs/core/** | |
chlorophyll: | |
- libs/chlorophyll/** | |
react: | |
- libs/react/** | |
react-charts: | |
- libs/react-charts/** | |
angular: | |
- libs/angular/** | |
angular-charts: | |
- libs/angular-charts/** | |
build: | |
runs-on: ubuntu-latest | |
needs: check | |
if: needs.check.outputs.status == 'true' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT" | |
- uses: actions/cache@v3 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: yarn install --prefer-offline --frozen-lockfile --silent | |
- name: Build storybook | |
run: yarn nx affected --target build-storybook --base=origin/main --parallel=false | |
- name: Did we build any? | |
id: has_storybooks | |
uses: andstor/file-existence-action@v3 | |
with: | |
files: './dist/storybook' | |
- name: Store PR number | |
if: steps.has_storybooks.outputs.files_exists == 'true' | |
run: echo ${{ github.event.number }} > ./dist/storybook/PR_NUMBER | |
- name: Upload Artifact | |
if: steps.has_storybooks.outputs.files_exists == 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pr | |
path: ./dist/storybook |