Skip to content

feat: resolve divine.video/@username to subdomain via NIP-05 #369

feat: resolve divine.video/@username to subdomain via NIP-05

feat: resolve divine.video/@username to subdomain via NIP-05 #369

Workflow file for this run

# ABOUTME: GitHub Actions workflow for deploying PR preview builds to Cloudflare Pages
# ABOUTME: Uses pull_request_target to enable fork PR previews with access to secrets
name: PR Preview Deploy
on:
pull_request_target:
types: [opened, synchronize, reopened]
jobs:
deploy-preview:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout PR head
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Deploy to Cloudflare Pages
id: deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy dist --project-name=divine-web-direct-deploy --branch=${{ github.event.pull_request.head.ref }}
- name: Comment preview URL on PR
uses: actions/github-script@v7
with:
script: |
const deploymentUrl = '${{ steps.deploy.outputs.deployment-url }}';
const sha = '${{ github.event.pull_request.head.sha }}'.substring(0, 7);
const branch = '${{ github.event.pull_request.head.ref }}';
const body = `## 🚀 Preview Deployment
| Property | Value |
|----------|-------|
| **Preview URL** | ${deploymentUrl} |
| **Commit** | \`${sha}\` |
| **Branch** | \`${branch}\` |`;
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const botComment = comments.find(comment =>
comment.user.type === 'Bot' &&
comment.body.includes('Preview Deployment')
);
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: context.issue.number,
body: body
});
}