build-storybook.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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: Checkout
  13. uses: actions/checkout@v4
  14. - name: Cache node modules
  15. uses: actions/cache@v3
  16. env:
  17. cache-name: cache-node-modules-bundle-web-app
  18. with:
  19. path: ~/.npm
  20. key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('web/package-lock.json') }}
  21. restore-keys: |
  22. ${{ runner.os }}-build-${{ env.cache-name }}-
  23. ${{ runner.os }}-build-
  24. ${{ runner.os }}-
  25. - name: Install and Build
  26. run: | # Install npm packages and build the Storybook files
  27. cd web
  28. npm install --include-dev --force
  29. cd .storybook/tools
  30. ./generate-stories.sh
  31. cd -
  32. npm run build-storybook -- -o ../docs/components
  33. - name: Commit changes
  34. uses: EndBug/add-and-commit@v9
  35. with:
  36. author_name: Owncast
  37. author_email: owncast@owncast.online
  38. message: 'Commit updated Storybook stories'
  39. add: '*.stories.*'
  40. pull: '--rebase --autostash'
  41. env:
  42. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  43. - name: Dispatch event to web site
  44. uses: peter-evans/repository-dispatch@v2
  45. with:
  46. token: ${{ secrets.BUNDLE_STORYBOOK_OWNCAST_ONLINE }}
  47. repository: owncast/owncast.github.io
  48. event-type: bundle-components-library