diff --git a/.github/workflows/vercel-deploy-staging.yml b/.github/workflows/vercel-deploy-staging.yml index b69aa441fe..1800daec07 100644 --- a/.github/workflows/vercel-deploy-staging.yml +++ b/.github/workflows/vercel-deploy-staging.yml @@ -2,6 +2,10 @@ name: Vercel Deploy Staging on: push: + branches: + - main + - "*.staging" + pull_request: workflow_call: # cancel in-progress runs on new commits to same PR (gitub.event.number) @@ -19,6 +23,7 @@ jobs: deployment: # Execute development and staging on staging branches # Execute only development on all other branches + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false strategy: matrix: environment: @@ -40,7 +45,7 @@ jobs: steps: - uses: actions/checkout@v5 with: - ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }} + ref: ${{ github.event.pull_request.head.sha || github.sha }} allow-unsafe-pr-checkout: ${{ github.event_name == 'pull_request_target' && github.event.action == 'labeled' && github.event.label.name == 'safe-to-deploy' }} - uses: ./.github/actions/submodules-checkout @@ -61,8 +66,8 @@ jobs: vercel-token: ${{ secrets.VERCEL_TOKEN }} vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} - ref-name: ${{ github.event_name == 'pull_request_target' && format('pr-{0}', github.event.pull_request.number) || github.ref_name }} - sha: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }} + ref-name: ${{ github.event.pull_request && format('pr-{0}', github.event.pull_request.number) || github.ref_name }} + sha: ${{ github.event.pull_request.head.sha || github.sha }} environment: ${{ matrix.environment }} production-staged: ${{ github.event_name == 'push' && matrix.environment == 'staging' && startsWith(github.ref_name, 'release-') && endsWith(github.ref_name, '.staging') }} PUBLIC_COLLAB_RELAY_URL: ${{ vars.PUBLIC_COLLAB_RELAY_URL }} @@ -102,19 +107,20 @@ jobs: builder-host: "${{ steps.vercel.outputs.alias }}.${{ matrix.environment }}.webstudio.is" deployment-host: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false runs-on: ubuntu-latest outputs: development-builder-host: ${{ steps.host.outputs.value }} steps: - uses: actions/checkout@v5 with: - ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }} + ref: ${{ github.event.pull_request.head.sha || github.sha }} allow-unsafe-pr-checkout: ${{ github.event_name == 'pull_request_target' && github.event.action == 'labeled' && github.event.label.name == 'safe-to-deploy' }} - id: host shell: bash env: - REF_NAME: ${{ github.event_name == 'pull_request_target' && format('pr-{0}', github.event.pull_request.number) || github.ref_name }} + REF_NAME: ${{ github.event.pull_request && format('pr-{0}', github.event.pull_request.number) || github.ref_name }} run: | clean_name=$(.github/actions/vercel/deployment-alias.sh "${REF_NAME}") echo "value=${clean_name}.development.webstudio.is" >> "$GITHUB_OUTPUT" @@ -136,4 +142,4 @@ jobs: needs: fixtures-test uses: ./.github/workflows/delete-github-deployments.yml with: - ref: ${{ github.event_name == 'pull_request_target' && format('pr-{0}', github.event.pull_request.number) || github.ref_name }} + ref: ${{ github.event.pull_request && format('pr-{0}', github.event.pull_request.number) || github.ref_name }} diff --git a/apps/builder/app/builder/shared/commands.ts b/apps/builder/app/builder/shared/commands.ts index 7cd8708fbc..763dea2e10 100644 --- a/apps/builder/app/builder/shared/commands.ts +++ b/apps/builder/app/builder/shared/commands.ts @@ -105,6 +105,7 @@ import { emitPaste, cutInstance, } from "~/shared/copy-paste/copy-paste"; +import { getInstanceLink } from "~/shared/instance-utils/link"; import { getDeletablePageActionTarget, getPageActionTarget, @@ -935,6 +936,26 @@ export const { emitCommand, subscribeCommands } = createCommandsEmitter({ void copyInstance(); }, }, + { + name: "copyInstanceLink", + hidden: true, + category: "Navigator", + defaultHotkeys: ["meta+l", "ctrl+l"], + disableOnInputLikeControls: true, + handler: async () => { + const link = getInstanceLink( + $selectedInstancePath.get()?.[0]?.instanceSelector + ); + if (link === undefined) { + return; + } + try { + await navigator.clipboard.writeText(link); + } catch { + toast.error("Could not copy link"); + } + }, + }, { name: "paste", description: "Paste copied instance(s)", diff --git a/apps/builder/app/builder/shared/instance-context-menu.tsx b/apps/builder/app/builder/shared/instance-context-menu.tsx index 2eef2caa0e..1946b738ce 100644 --- a/apps/builder/app/builder/shared/instance-context-menu.tsx +++ b/apps/builder/app/builder/shared/instance-context-menu.tsx @@ -14,7 +14,6 @@ import { theme, Kbd, Box, - toast, } from "@webstudio-is/design-system"; import { showAttribute } from "@webstudio-is/react-sdk"; import { emitCommand, instanceMoveCommandMetas } from "./commands"; @@ -34,10 +33,7 @@ import { type InstancePath, } from "@webstudio-is/project-build/runtime"; import { canDeleteInstanceInContentMode } from "@webstudio-is/project-build/runtime"; -import { - getInstanceLink, - getDeepLinkedInstanceSelection, -} from "~/shared/instance-utils/link"; +import { getDeepLinkedInstanceSelection } from "~/shared/instance-utils/link"; import { $instances, $pages, $project } from "~/shared/sync/data-stores"; import { isComponentDetachable, @@ -205,20 +201,19 @@ export const MenuItems = () => { { - const link = getInstanceLink(instanceSelector); - if (link === undefined) { - return; - } - try { - await navigator.clipboard.writeText(link); - toast.success("Link copied"); - } catch { - toast.error("Could not copy link"); - } + onSelect={() => { + emitCommand("copyInstanceLink"); }} > Copy link to instance + + + { // Resource E2E fixtures use loopback URLs. Keep this exception limited to // the dedicated test server; production uses the public-address guard. process.env.E2E_ALLOW_LOCAL_RESOURCE_URLS = "true"; + // Allow the dedicated E2E server's local HTTPS certificate for loopback + // service-to-service fetches such as oauth.ws.token, matching vite.config.ts + // and e2e/setup.ts. + process.env.NODE_TLS_REJECT_UNAUTHORIZED ??= "0"; const serverDirectory = path.resolve("build/server"); const builds = await Promise.all( readdirSync(serverDirectory, { withFileTypes: true }) diff --git a/docs/university/foundations/navigator.md b/docs/university/foundations/navigator.md index 2166f58e5e..06e2e44101 100644 --- a/docs/university/foundations/navigator.md +++ b/docs/university/foundations/navigator.md @@ -37,10 +37,11 @@ keeps the remaining selection intact. ### Link to a selected instance -Right-click an instance and choose **Copy link to instance** to copy its full -Builder URL to the clipboard. Share the link to open the same page and select -the same instance, including its location inside a shared Slot. Select one -instance at a time; this action is unavailable for Global Root. +Right-click an instance and choose **Copy link to instance** +(`⌘ + L` on macOS, `Ctrl + L` on Windows when not intercepted by the browser) +to copy its full Builder URL to the clipboard. Share the link to open the same +page and select the same instance, including its location inside a shared Slot. +Select one instance at a time; this action is unavailable for Global Root. The recipient needs access to the project. If you opened the Builder through a share link, the copied URL keeps that share link’s access token. diff --git a/docs/university/foundations/shortcuts.md b/docs/university/foundations/shortcuts.md index 82b3543864..3cf0eed478 100644 --- a/docs/university/foundations/shortcuts.md +++ b/docs/university/foundations/shortcuts.md @@ -30,6 +30,7 @@ icon: command ## **Sidebar Left** - Copy: `⌘ + c` +- Copy link to instance: `⌘ + l` (macOS) / `Ctrl + l` (Windows, when not intercepted by the browser) - Cut: `⌘ + x` - Paste: `⌘ + v` - Duplicate: `⌘ + d` diff --git a/packages/design-system/src/components/kbd.tsx b/packages/design-system/src/components/kbd.tsx index 5d4cacd425..e156f18ea0 100644 --- a/packages/design-system/src/components/kbd.tsx +++ b/packages/design-system/src/components/kbd.tsx @@ -4,6 +4,7 @@ const isMac = typeof navigator === "object" ? /mac/i.test(navigator.platform) : false; const shortcutSymbolMap: Record = { + // Cross-platform primary modifier: ⌘ on macOS, Ctrl elsewhere. meta: isMac ? "⌘" : "Ctrl", shift: "⇧", alt: isMac ? "⌥" : "Alt",