Skip to content

feat(worker): add proxy routes for Beacon API, Bitcoin RPC and EVM RPC #492

feat(worker): add proxy routes for Beacon API, Bitcoin RPC and EVM RPC

feat(worker): add proxy routes for Beacon API, Bitcoin RPC and EVM RPC #492

name: Build and Deploy PR Preview
on:
pull_request_target:
types: [opened, synchronize, reopened]
permissions:
contents: read
pull-requests: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout PR head
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build Staging
run: ./scripts/build-staging.sh
- name: Deploy to Netlify
id: netlify
uses: nwtgck/actions-netlify@v3
with:
publish-dir: './dist'
production-deploy: false
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "PR Preview #${{ github.event.pull_request.number }}"
alias: pr-${{ github.event.pull_request.number }}
enable-pull-request-comment: false
enable-commit-comment: false
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
- name: Comment PR with Preview URL
uses: actions/github-script@v7
with:
script: |
const prNumber = ${{ github.event.pull_request.number }};
const deployUrl = '${{ steps.netlify.outputs.deploy-url }}';
const body = `🚀 **Preview:** ${deployUrl}\n📝 **Commit:** \`${{ github.event.pull_request.head.sha }}\``;
// Find existing comment
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});
const botComment = comments.find(comment =>
comment.user.type === 'Bot' &&
comment.body.includes('Preview:')
);
if (botComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: body
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: body
});
}