docs: PR demo on gh pages #7515
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 Demo CI | |
on: | |
pull_request: | |
push: | |
branches: [master] | |
permissions: | |
contents: write | |
pull-requests: write | |
statuses: write | |
checks: write | |
pages: write | |
# This allows a subsequently queued workflow run to interrupt previous runs | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build demo on PR | |
environment: pull_request_unsafe | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4.0.0 | |
- name: Use Node.js | |
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 | |
with: | |
node-version: 18 | |
registry-url: "https://registry.npmjs.org/" | |
scope: "@talend" | |
cache: "yarn" | |
- name: cache for storybook | |
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 #v3.3.2 | |
with: | |
path: packages/*/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
- name: Install | |
working-directory: ./ | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_READ_TOKEN }} | |
run: yarn install --frozen-lockfile | |
- name: Build | |
run: yarn test:demo | |
env: | |
STORYBOOK_FIGMA_ACCESS_TOKEN: ${{ secrets.STORYBOOK_FIGMA_ACCESS_TOKEN }} | |
- name: Checkout demo branch | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 | |
with: | |
path: demo | |
ref: gh-pages | |
- name: Add demo and commit it | |
# symlink creation : workaround to be able to use service worker on storybook both in local and via github pages deployment | |
run: | | |
cd demo && git rm -rf --ignore-unmatch ${{ github.event.number }} && cd .. | |
mkdir -p ./demo/${{ github.event.number }} | |
cp -R storybook-static/* ./demo/${{ github.event.number }}/ | |
cd demo && git add . | |
- name: Commit demo for gh-pages | |
uses: actions-js/push@156f2b10c3aa000c44dbe75ea7018f32ae999772 #v1.4 | |
with: | |
directory: './demo' | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
message: 'doc: update demo from ${{ github.event.number }}' | |
branch: gh-pages | |
- name: Create comment | |
uses: peter-evans/create-or-update-comment@c6c9a1a66007646a28c153e2a8580a5bad27bcfa #v3.0.2 | |
with: | |
issue-number: ${{ github.event.number }} | |
body: | | |
Storybook for this PR deployed on this [github page](https://crispy-disco-7v8q1pm.pages.github.io/${{ github.event.number }}) |