build-storybook.yml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. name: Build and Deploy Components+Style Guide
  2. on:
  3. push:
  4. branches:
  5. - develop
  6. paths: ['web/stories/**', 'web/components/**', 'web/.storybook/**'] # Trigger the action only when files change in the folders defined here
  7. jobs:
  8. build-and-deploy:
  9. runs-on: ubuntu-latest
  10. if: github.repository == 'owncast/owncast'
  11. steps:
  12. - name: Check out pull request code
  13. uses: actions/checkout@v4
  14. if: github.event_name == 'pull_request'
  15. with:
  16. repository: ${{ github.event.pull_request.head.repo.full_name }}
  17. - name: Check out repository code
  18. uses: actions/checkout@v4
  19. if: github.event_name == 'push'
  20. - name: Cache node modules
  21. uses: actions/cache@v4
  22. env:
  23. cache-name: cache-node-modules-bundle-web-app
  24. with:
  25. path: ~/.npm
  26. key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('web/package-lock.json') }}
  27. restore-keys: |
  28. ${{ runner.os }}-build-${{ env.cache-name }}-
  29. ${{ runner.os }}-build-
  30. ${{ runner.os }}-
  31. - name: Install and Build
  32. run: | # Install npm packages and build the Storybook files
  33. cd web
  34. npm install --include-dev --force
  35. cd .storybook/tools
  36. ./generate-stories.sh
  37. cd -
  38. npm run build-storybook -- -o ../docs/components
  39. - name: Commit changes
  40. uses: EndBug/add-and-commit@v9
  41. with:
  42. author_name: Owncast
  43. author_email: owncast@owncast.online
  44. message: 'Commit updated Storybook stories'
  45. add: '*.stories.*'
  46. pull: '--rebase --autostash'
  47. env:
  48. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  49. - name: Dispatch event to web site
  50. uses: peter-evans/repository-dispatch@v3
  51. with:
  52. token: ${{ secrets.BUNDLE_STORYBOOK_OWNCAST_ONLINE }}
  53. repository: owncast/owncast.github.io
  54. event-type: bundle-components-library