deploy-latest-storybook #43
This file contains hidden or 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
| # Deploy production storybook environment from release branch to Github Pages | |
| name: Deploy production storybook | |
| # This workflow is triggered from the `release-base` workflow when a full release | |
| # has been successfully completed | |
| on: | |
| workflow_dispatch: | |
| repository_dispatch: | |
| types: [deploy-latest-storybook] | |
| jobs: | |
| deploy-latest-storybook: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| permissions: | |
| contents: write | |
| steps: | |
| # Checkout release branch to build storybook | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| fetch-depth: '0' | |
| ref: ${{ github.event.client_payload.branch }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
| with: | |
| node-version: '20.x' | |
| registry-url: https://registry.npmjs.org | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install | |
| - name: Build storybook | |
| run: | | |
| yarn build | |
| yarn storybook-wc:build | |
| # Set authenticated Git remote | |
| - name: Set authenticated Git remote | |
| run: git remote set-url origin https://git:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
| # Deploy to staging Github Pages using `gh-pages` package | |
| - name: Prepare latest directory | |
| run: | | |
| mkdir -p latest-dist/react | |
| cp -r packages/ibm-products/storybook-static/* latest-dist/react | |
| mkdir -p latest-dist/web-components | |
| cp -r packages/ibm-products-web-components/storybook-static/* latest-dist/web-components | |
| - name: Deploy latest Storybooks to gh-pages/latest | |
| run: | | |
| npx gh-pages -d latest-dist \ | |
| -u "github-actions-bot <[email protected]>" \ | |
| --dest latest \ | |
| --message "chore(deploy): deploy React and Web Components Storybooks to latest" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |