[no merge] added github action to launch storybook on pr #10
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-storybook-preview | |
on: | |
pull_request: | |
# paths: | |
# - next-client/** | |
branches: | |
- "**" | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18.x" | |
- name: Install and build common | |
run: npm install && npm run build | |
working-directory: common | |
- name: Install dependencies | |
run: npm install | |
working-directory: next-client | |
- name: Build Storybook | |
run: npm run build-storybook --quiet | |
working-directory: next-client | |
- name: Deploy to GitHub Pages | |
if: github.event_name == 'pull_request' && success() | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./next-client/storybook-static | |
- name: Comment Storybook URL on PR | |
if: github.event_name == 'pull_request' && success() | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
message: "Storybook preview is available [here](https://${{ github.repository_owner }}.github.io/${{ github.repository }}/storybook-static)" |