[BD-8468][BpkCarousel] new component for mobile #968
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: PR | |
on: | |
pull_request: | |
branches: [main] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -l {0} | |
env: | |
CACHE_NAME: node-modules-cache | |
BUILD_CACHE_NAME: build-cache | |
jobs: | |
Create-NPM-Cache: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
registry-url: 'https://registry.npmjs.org' | |
- name: Upload to Cache | |
uses: actions/[email protected] | |
id: npm-cache | |
with: | |
path: | | |
node_modules/ | |
packages/node_modules/ | |
key: ${{ env.CACHE_NAME }}-${{ hashFiles('**/package-lock.json') }} | |
- name: Install dependencies | |
if: ${{ steps.npm-cache.outputs.cache-hit != 'true' }} | |
run: npm ci | |
Create-Build-Cache: | |
runs-on: ubuntu-latest | |
needs: [Create-NPM-Cache] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
registry-url: 'https://registry.npmjs.org' | |
- name: Restore NPM Cache | |
uses: actions/cache/[email protected] | |
id: npm-cache | |
with: | |
path: | | |
node_modules/ | |
packages/node_modules/ | |
key: ${{ env.CACHE_NAME }}-${{ hashFiles('**/package-lock.json') }} | |
- name: Upload dist-storybook to Cache | |
uses: actions/[email protected] | |
id: storybook-dist-cache | |
with: | |
path: | | |
dist-storybook/ | |
key: ${{ env.BUILD_CACHE_NAME }}-${{ hashFiles('packages/**') }} | |
- name: Create build cache | |
if: ${{ steps.storybook-dist-cache.outputs.cache-hit != 'true' }} | |
run: | | |
npm run build | |
npm run storybook:dist | |
Build: | |
permissions: | |
statuses: write | |
pull-requests: write | |
needs: [Create-NPM-Cache, Create-Build-Cache] | |
uses: ./.github/workflows/_build.yml | |
secrets: inherit | |
StorybookDeploy: | |
runs-on: ubuntu-latest | |
needs: [Create-NPM-Cache, Create-Build-Cache] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
registry-url: 'https://registry.npmjs.org' | |
- name: Restore npm Cache | |
uses: actions/cache/[email protected] | |
id: npm-cache | |
with: | |
path: | | |
node_modules/ | |
packages/node_modules/ | |
key: ${{ env.CACHE_NAME }}-${{ hashFiles('**/package-lock.json') }} | |
- name: Restore Cache | |
uses: actions/cache/[email protected] | |
id: storybook-dist-cache | |
with: | |
path: dist-storybook/ | |
key: ${{ env.BUILD_CACHE_NAME }}-${{ hashFiles('packages/**') }} | |
- name: Prepare to deploy Storybook (pull request build) | |
run: | | |
mkdir build | |
mv dist-storybook $PR_NUMBER | |
cp -R $PR_NUMBER build/ | |
if: github.ref != 'refs/heads/main' && github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' | |
env: | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
- name: Deploy Storybook to backpack.github.io/storybook-prs | |
uses: peaceiris/actions-gh-pages@v3 | |
if: github.ref != 'refs/heads/main' && github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' | |
with: | |
personal_token: ${{ secrets.DEPLOY_TOKEN }} | |
publish_dir: build/ | |
keep_files: true | |
external_repository: backpack/storybook-prs | |
publish_branch: main | |
- name: Link to the pull request build | |
uses: actions/github-script@v6 | |
if: github.ref != 'refs/heads/main' && github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `Visit https://backpack.github.io/storybook-prs/${{ env.PR_NUMBER }} to see this build running in a browser.` | |
}) | |
env: | |
PR_NUMBER: ${{ github.event.pull_request.number }} |