Skip to content

[TRAH] Sergei / TRAH 3146 / Add performance metrics for trader's hub new repo #146

[TRAH] Sergei / TRAH 3146 / Add performance metrics for trader's hub new repo

[TRAH] Sergei / TRAH 3146 / Add performance metrics for trader's hub new repo #146

name: Generate preview link
on:
pull_request_target:
types: [opened, synchronize]
branches: [main]
env:
HEAD_REF: ${{ github.head_ref }}
concurrency:
group: cloudflare-pages-build-"$HEAD_REF"
cancel-in-progress: true
jobs:
build_and_deploy_preview_link:
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
pull-requests: write
steps:
- name: Verify user
uses: "deriv-com/shared-actions/.github/actions/verify_user_in_organization@v1"
with:
username: ${{github.event.pull_request.user.login}}
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Post preview build comment
id: post_preview_build_comment
uses: "deriv-com/shared-actions/.github/actions/post_preview_build_comment@v1"
with:
issue_number: ${{github.event.number}}
head_sha: ${{github.event.pull_request.head.sha}}
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
ref: ${{github.event.pull_request.head.sha}}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8
with:
node-version: 20.x
- name: Install dependencies
uses: "./.github/actions/npm_install"
- name: Build
run: npm run build
shell: bash
- name: "Run Tests"
run: npm run test:report
- name: Publish to CF pages branch
id: publish_to_pages_branch
uses: "deriv-com/shared-actions/.github/actions/publish_to_pages_branch@v1"
with:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_TEST_LINKS_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_TEST_LINKS_ACCOUNT_ID }}
project_name: "traders-hub"
branch_name: "pr-${{github.event.number}}"
output_dir: dist
- name: "Generate preview link comment"
uses: "deriv-com/shared-actions/.github/actions/post_preview_link_comment@v1"
if: always() && steps.post_preview_build_comment.outcome == 'success'
with:
issue_number: ${{github.event.number}}
check_run_id: ${{steps.post_preview_build_comment.outputs.check_run_id}}
preview_url: ${{steps.publish_to_pages_branch.outputs.cf_pages_url}}
status: ${{job.status}}