✨ Implement Button recipe from Figma design #36
Workflow file for this run
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
| name: Preview | |
| on: | |
| pull_request: | |
| types: [ opened, synchronize ] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| name: Deploy | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| name: Install pnpm | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build storybook | |
| run: pnpm --filter @chlorophyll/storybook build | |
| - name: Build docs | |
| run: pnpm --filter @chlorophyll/docs build | |
| - name: Deploy storybook preview | |
| id: deploy-storybook-preview | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CF_API_KEY }} | |
| accountId: ${{ secrets.CF_ACCOUNT_ID }} | |
| workingDirectory: storybook | |
| packageManager: pnpm | |
| command: versions upload --message "Deployed pages by GitHub Actions branch ${{ github.ref_name }}" | |
| - name: Deploy docs preview | |
| id: deploy-docs-preview | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CF_API_KEY }} | |
| accountId: ${{ secrets.CF_ACCOUNT_ID }} | |
| workingDirectory: docs | |
| packageManager: pnpm | |
| command: versions upload --message "Deployed pages by GitHub Actions branch ${{ github.ref_name }}" | |
| - name: print deployment-url | |
| env: | |
| STORYBOOK_DEPLOYMENT_URL: ${{ steps.deploy-storybook-preview.outputs.deployment-url }} | |
| DOCS_DEPLOYMENT_URL: ${{ steps.deploy-docs-preview.outputs.deployment-url }} | |
| run: | | |
| echo $STORYBOOK_DEPLOYMENT_URL | |
| echo $DOCS_DEPLOYMENT_URL | |
| - name: Create comment file | |
| id: create-comment-file | |
| env: | |
| STORYBOOK_DEPLOYMENT_URL: ${{ steps.deploy-storybook-preview.outputs.deployment-url }} | |
| DOCS_DEPLOYMENT_URL: ${{ steps.deploy-docs-preview.outputs.deployment-url }} | |
| run: | | |
| cat << EOF > comment.md | |
| ## 🚀 Deploying ${{ github.event.repository.name }} with Cloudflare Workers | |
| <table> | |
| <tr> | |
| <th scope="row">Storybook</th> | |
| <td><a href="$STORYBOOK_DEPLOYMENT_URL">$STORYBOOK_DEPLOYMENT_URL</a></td> | |
| </tr> | |
| <tr> | |
| <th scope="row">Docs</th> | |
| <td><a href="$DOCS_DEPLOYMENT_URL">$DOCS_DEPLOYMENT_URL</a></td> | |
| </tr> | |
| </table> | |
| EOF | |
| - name: Create PR comment | |
| run: gh pr comment ${{ github.event.number }} --body-file comment.md | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |