# This workflow builds and deploys Storybook component documentation # Triggers: # - Push to develop branch with changes to: # - web/stories/** (story files) # - web/components/** (component source) # - web/.storybook/** (Storybook config) # - web/i18n/** (translations) # Output: # - Generates updated story files # - Builds Storybook to docs/components # - Dispatches event to owncast.github.io for deployment name: Build and Deploy Components+Style Guide on: push: branches: - develop paths: [ 'web/stories/**', 'web/components/**', 'web/.storybook/**', 'web/i18n/**', ] # Trigger the action only when files change in the folders defined here jobs: build-and-deploy: runs-on: ubuntu-latest if: github.repository == 'owncast/owncast' steps: - id: skip_check uses: fkirc/skip-duplicate-actions@v5 with: concurrent_skipping: 'same_content_newer' cancel_others: 'true' skip_after_successful_duplicate: 'true' - name: Check out pull request code uses: actions/checkout@v6 if: github.event_name == 'pull_request' with: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.event.pull_request.head.ref }} - name: Check out repository code uses: actions/checkout@v6 if: github.event_name == 'push' - name: Cache node modules uses: actions/cache@v5 env: cache-name: cache-node-modules-bundle-web-app with: path: ~/.npm key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('web/package-lock.json') }} restore-keys: | ${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-build- ${{ runner.os }}- - name: Install and Build run: | # Install npm packages and build the Storybook files cd web npm install --include-dev --force cd .storybook/tools ./generate-stories.sh cd - npm run build-storybook -- -o ../docs/components - name: Commit changes if: github.repository == 'owncast/owncast' uses: EndBug/add-and-commit@v9 with: author_name: Owncast author_email: owncast@owncast.online message: 'Commit updated Storybook stories' add: '*.stories.*' pull: '--rebase --autostash' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Dispatch event to web site if: github.repository == 'owncast/owncast' uses: peter-evans/repository-dispatch@v4 with: token: ${{ secrets.BUNDLE_STORYBOOK_OWNCAST_ONLINE }} repository: owncast/owncast.github.io event-type: bundle-components-library