From cca6856da199b7b909f6bf37bdd03e2d512fbae6 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Thu, 9 Apr 2026 16:59:07 +0000 Subject: [PATCH] feat(docs): deploy main branch preview alongside PR previews Extend the docs-preview workflow to also trigger on pushes to main, deploying a continuously-updated preview at _preview/pr-main/ on gh-pages. Rename the umbrella directory from pr-preview to _preview. - Add push:main trigger with same path filters as pull_request - Use conditional action inputs (deploy+no comment for main, auto for PRs) - Scope concurrency per-ref with cancel-in-progress - Update astro landing page regex for the new _preview path --- .github/workflows/docs-preview.yml | 24 ++++++++++++++++++++---- docs/astro.config.mjs | 2 +- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index e7e0d5f26..730201e56 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -1,6 +1,15 @@ name: Docs Preview on: + push: + branches: [main] + paths: + - 'docs/**' + - 'src/**' + - 'script/generate-command-docs.ts' + - 'script/generate-skill.ts' + - 'install' + - '.github/workflows/docs-preview.yml' pull_request: paths: - 'docs/**' @@ -14,6 +23,10 @@ permissions: contents: write pull-requests: write +concurrency: + group: docs-preview-${{ github.ref }} + cancel-in-progress: true + jobs: preview: runs-on: ubuntu-latest @@ -41,8 +54,9 @@ jobs: - name: Build Docs for Preview working-directory: docs env: - # Override base path for PR preview (no /cli prefix since preview domain is different) - DOCS_BASE_PATH: /pr-preview/pr-${{ github.event.pull_request.number }} + DOCS_BASE_PATH: ${{ github.event_name == 'push' + && '/_preview/pr-main' + || format('/_preview/pr-{0}', github.event.pull_request.number) }} PUBLIC_SENTRY_ENVIRONMENT: staging SENTRY_RELEASE: ${{ steps.version.outputs.version }} PUBLIC_SENTRY_RELEASE: ${{ steps.version.outputs.version }} @@ -102,6 +116,8 @@ jobs: with: source-dir: docs/dist/ preview-branch: gh-pages - umbrella-dir: pr-preview + umbrella-dir: _preview pages-base-url: cli.sentry.dev - action: auto + action: ${{ github.event_name == 'push' && 'deploy' || 'auto' }} + pr-number: ${{ github.event_name == 'push' && 'main' || github.event.pull_request.number }} + comment: ${{ github.event_name != 'push' }} diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index 523b9b447..0d75724fd 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -82,7 +82,7 @@ export default defineConfig({ const path = window.location.pathname; // Works with both / (prod) and /pr-preview/pr-XX (preview) return path === '/' || - /^\\/pr-preview\\/pr-\\d+\\/?$/.test(path); + /^\\/_preview\\/pr-(\\d+|main)\\/?$/.test(path); } function checkAtBottom() {