Skip to content

feat: add storybook preview to pr links #7065

feat: add storybook preview to pr links

feat: add storybook preview to pr links #7065

Workflow file for this run

name: PR extension build
on: [pull_request, workflow_dispatch]
jobs:
pre-run:
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@main
with:
access_token: ${{ github.token }}
set-in-progress-message:
if: github.repository == 'leather-wallet/extension' && github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- name: Make short commit SHA
run: echo "SHORT_SHA=`echo ${{ github.event.pull_request.head.sha }} | cut -c1-7`" >> $GITHUB_ENV
- uses: kyranjamie/[email protected]
with:
header: '> _Building Leather at commit ${{ env.SHORT_SHA }}_'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
name: build-${{ matrix.target }}-extension
runs-on: ubuntu-latest
needs:
- pre-run
strategy:
matrix:
# Firefox removed while off store
target: [chromium]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: ./.github/actions/provision
- run: echo "SHORT_SHA=`echo ${{ github.event.pull_request.head.sha }} | cut -c1-7`" >> $GITHUB_ENV
- name: Build project
run: pnpm build
env:
WALLET_ENVIRONMENT: feature
TARGET_BROWSER: ${{ matrix.target }}
COINBASE_APP_ID: ${{ secrets.COINBASE_APP_ID }}
MOONPAY_API_KEY: ${{ secrets.MOONPAY_API_KEY }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY_STAGING }}
TRANSAK_API_KEY: ${{ secrets.TRANSAK_API_KEY }}
BESTINSLOT_API_KEY: ${{ secrets.BESTINSLOT_API_KEY }}
PR_NUMBER: ${{ github.event.number }}
COMMIT_SHA: ${{ env.SHORT_SHA }}
- uses: actions/upload-artifact@v3
name: Upload ${{ matrix.target }} extension zip
with:
name: leather-${{ matrix.target }}-${{ env.SHORT_SHA }}
path: dist
chromatic:
runs-on: ubuntu-latest
outputs:
storybookUrl: ${{ steps.storybook.outputs.url }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/provision
- name: Deploy to Chromatic
uses: chromaui/action@latest
with:
autoAcceptChanges: 'main'
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract storybook url
shell: bash
run: echo "url=${{ steps.chromatic.outputs.storybookUrl }}" >> $GITHUB_OUTPUT
id: storybook
set-download-link:
if: github.repository == 'leather-wallet/extension' && github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
needs:
- pre-run
- build
- chromatic
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- uses: kyranjamie/[email protected]
with:
header: '> Try out this version of Leather — [Extension build](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}), [Test report](https://leather-wallet.github.io/playwright-reports/${{ steps.extract_branch.outputs.branch }}), [Storybook preview](${{ needs.chromatic.outputs.storybookUrl }})'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}