Skip to content

Commit 3abd21c

Browse files
committed
feat: add custom domain
1 parent 5f5afff commit 3abd21c

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

.github/actions/vercel-deploy/action.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,20 @@ inputs:
1414
required: true
1515
vercel_token:
1616
required: true
17+
custom_domain:
18+
description: "Custom domain in the format {locale}-{pr}.nextjs.im (optional)"
19+
required: false
20+
default: ""
1721
outputs:
1822
inspect_url:
1923
description: "Vercel inspect URL"
2024
value: ${{ steps.vercel_deploy.outputs.inspect_url }}
2125
prod_url:
2226
description: "Vercel preview/production URL"
2327
value: ${{ steps.vercel_deploy.outputs.prod_url }}
28+
custom_domain_url:
29+
description: "Custom domain URL if set"
30+
value: ${{ steps.set_custom_domain.outputs.custom_domain_url }}
2431
runs:
2532
using: "composite"
2633
steps:
@@ -56,3 +63,15 @@ runs:
5663
VERCEL_PROJECT_ID: ${{ inputs.vercel_project_id }}
5764
VERCEL_ORG_ID: ${{ inputs.vercel_org_id }}
5865
shell: bash
66+
- name: Set Custom Domain (if provided)
67+
id: set_custom_domain
68+
if: ${{ inputs.custom_domain != '' }}
69+
run: |
70+
deployment_url=${{ steps.vercel_deploy.outputs.prod_url }}
71+
custom_domain="${{ inputs.custom_domain }}"
72+
npx vercel alias set "$deployment_url" "$custom_domain" --token=${{ inputs.vercel_token }}
73+
echo "custom_domain_url=https://$custom_domain" >> $GITHUB_OUTPUT
74+
env:
75+
VERCEL_PROJECT_ID: ${{ inputs.vercel_project_id }}
76+
VERCEL_ORG_ID: ${{ inputs.vercel_org_id }}
77+
shell: bash

.github/workflows/prerelease.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ jobs:
6868
vercel_project_id: ${{ secrets[matrix.secret_project_id] }}
6969
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
7070
vercel_token: ${{ secrets.VERCEL_TOKEN }}
71+
custom_domain: ${{ matrix.locale }}-${{ github.event.pull_request.number }}.nextjs.im
7172
- name: Comment PR with Vercel Preview Links (${{ matrix.locale }})
7273
if: steps.should_deploy.outputs.should_deploy == 'true'
7374
uses: ./.github/actions/comment-vercel-preview

0 commit comments

Comments
 (0)