Skip to content

Design update, native macOS executor app, release CI, and app-first connect flow #131

Design update, native macOS executor app, release CI, and app-first connect flow

Design update, native macOS executor app, release CI, and app-first connect flow #131

name: Deploy UI to Vercel
on:
workflow_dispatch:
push:
branches:
- main
paths:
- ".github/workflows/deploy-ui-vercel.yml"
- "src/newbro/ui/**"
pull_request:
paths:
- ".github/workflows/deploy-ui-vercel.yml"
- "src/newbro/ui/**"
permissions:
contents: read
issues: write
pull-requests: write
concurrency:
group: vercel-ui-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy-preview:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
env:
VERCEL_ORG_ID: ${{ vars.VERCEL_ORG_ID || secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ vars.VERCEL_PROJECT_ID || secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
defaults:
run:
working-directory: src/newbro/ui
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "24"
- name: Validate Vercel config
run: |
test -n "$VERCEL_ORG_ID"
test -n "$VERCEL_PROJECT_ID"
test -n "$VERCEL_TOKEN"
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel environment
run: vercel pull --yes --environment=preview --token="$VERCEL_TOKEN"
- name: Build preview artifacts
run: vercel build --token="$VERCEL_TOKEN"
- name: Deploy preview
id: deploy_preview
run: |
deployment_url="$(vercel deploy --prebuilt --token="$VERCEL_TOKEN")"
echo "deployment_url=$deployment_url" >> "$GITHUB_OUTPUT"
- name: Comment preview URL on PR
uses: actions/github-script@v7
env:
DEPLOYMENT_URL: ${{ steps.deploy_preview.outputs.deployment_url }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const marker = "<!-- vercel-preview-comment -->";
const previewUrl = process.env.DEPLOYMENT_URL;
const body = `${marker}
Vercel preview is ready.
${previewUrl}`;
const { owner, repo } = context.repo;
const issue_number = context.payload.pull_request.number;
const comments = await github.paginate(github.rest.issues.listComments, {
owner,
repo,
issue_number,
});
const existing = comments.find((comment) => {
return comment.user?.type === "Bot" && comment.body?.includes(marker);
});
if (existing) {
await github.rest.issues.updateComment({
owner,
repo,
comment_id: existing.id,
body,
});
return;
}
await github.rest.issues.createComment({
owner,
repo,
issue_number,
body,
});
deploy-production:
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
env:
VERCEL_ORG_ID: ${{ vars.VERCEL_ORG_ID || secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ vars.VERCEL_PROJECT_ID || secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VITE_API_BASE_URL: https://newbro.plutoless.com
VITE_GATEWAY_BASE_URL: https://newbro.plutoless.com
defaults:
run:
working-directory: src/newbro/ui
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "24"
- name: Validate Vercel config
run: |
test -n "$VERCEL_ORG_ID"
test -n "$VERCEL_PROJECT_ID"
test -n "$VERCEL_TOKEN"
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel environment
run: vercel pull --yes --environment=production --token="$VERCEL_TOKEN"
- name: Validate production frontend env
run: |
test -n "$VITE_API_BASE_URL"
test -n "$VITE_GATEWAY_BASE_URL"
case "$VITE_API_BASE_URL" in
https://*) ;;
*)
echo "VITE_API_BASE_URL must be an https:// URL"
exit 1
;;
esac
case "$VITE_GATEWAY_BASE_URL" in
https://*) ;;
*)
echo "VITE_GATEWAY_BASE_URL must be an https:// URL"
exit 1
;;
esac
- name: Build production artifacts
run: vercel build --prod --token="$VERCEL_TOKEN"
- name: Deploy production
run: vercel deploy --prebuilt --prod --token="$VERCEL_TOKEN"