From d6d1b1796e6bb21470cee752a746aa9df010e9ae Mon Sep 17 00:00:00 2001 From: Guy Smoilovsky Date: Mon, 11 May 2026 11:42:29 +0300 Subject: [PATCH 1/3] Deploy client docs to Azure SWA instead of GCS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Push to main deploys to test.dagshub.com/docs/client - GitHub release publishes to dagshub.com/docs/client - workflow_dispatch deploys to test (retry lane) - PR builds without deploying Replaces gsutil rsync + gcloud invalidate-cdn-cache with swa deploy against the new dagshub-{test,prod}-client-docs-swa Azure Static Web Apps. Requires two new GitHub repo secrets before this workflow can deploy: SWA_DEPLOY_TOKEN_TEST — from az staticwebapp secrets list --name dagshub-test-client-docs-swa SWA_DEPLOY_TOKEN_PROD — from az staticwebapp secrets list --name dagshub-prod-client-docs-swa The old GCS_PROJECT, GCS_SERVICE_ACCOUNT_ACCESS_KEY, DOCS_BUCKET, and LOAD_BALANCER_NAME secrets can be removed once this lands. --- .github/workflows/docs-publish.yml | 65 ++++++++++++++++------- docs/deploy/root-index.html | 7 +++ docs/deploy/staticwebapp.config.prod.json | 15 ++++++ docs/deploy/staticwebapp.config.test.json | 15 ++++++ 4 files changed, 83 insertions(+), 19 deletions(-) create mode 100644 docs/deploy/root-index.html create mode 100644 docs/deploy/staticwebapp.config.prod.json create mode 100644 docs/deploy/staticwebapp.config.test.json diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml index 2edf997d..b3127b89 100644 --- a/.github/workflows/docs-publish.yml +++ b/.github/workflows/docs-publish.yml @@ -2,6 +2,9 @@ name: Docs on: workflow_dispatch: + push: + branches: + - main release: types: [ published ] pull_request: @@ -39,40 +42,64 @@ jobs: run: SPHINXOPTS="-W" make html - name: Upload build artifact - if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' + if: github.event_name != 'pull_request' uses: actions/upload-artifact@v4 with: name: docs-html path: docs/build/html - deploy: - name: Deploy documentation + deploy-test: + name: Deploy to test.dagshub.com needs: build - if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' + if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 + - name: Download build artifact uses: actions/download-artifact@v4 with: name: docs-html - path: docs-html - - - name: Authenticate with Google - uses: "google-github-actions/auth@v2" - with: - project_id: ${{ secrets.GCS_PROJECT }} - credentials_json: ${{ secrets.GCS_SERVICE_ACCOUNT_ACCESS_KEY }} + path: build/html - - name: Set up Cloud SDK - uses: "google-github-actions/setup-gcloud@v2" + - name: Assemble deploy package + run: | + mkdir -p dist/docs/client + cp -r build/html/. dist/docs/client/ + cp docs/deploy/root-index.html dist/index.html + cp docs/deploy/staticwebapp.config.test.json dist/staticwebapp.config.json + curl -sSf https://test.dagshub.com/this-does-not-exist -o dist/404.html - - name: Upload to Google Cloud Storage + - name: Deploy to test SWA env: - UPLOAD_PATH: ${{ format('gs://{0}/docs/client', secrets.DOCS_BUCKET) }} - run: gsutil -m rsync -d -r docs-html $UPLOAD_PATH + SWA_DEPLOY_TOKEN: ${{ secrets.SWA_DEPLOY_TOKEN_TEST }} + run: npx --yes @azure/static-web-apps-cli deploy ./dist --deployment-token "$SWA_DEPLOY_TOKEN" --env production + + deploy-prod: + name: Deploy to dagshub.com + needs: build + if: github.event_name == 'release' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: docs-html + path: build/html + + - name: Assemble deploy package + run: | + mkdir -p dist/docs/client + cp -r build/html/. dist/docs/client/ + cp docs/deploy/root-index.html dist/index.html + cp docs/deploy/staticwebapp.config.prod.json dist/staticwebapp.config.json + curl -sSf https://dagshub.com/this-does-not-exist -o dist/404.html - - name: Invalidate CDN Cache + - name: Deploy to prod SWA env: - LOAD_BALANCER: ${{ secrets.LOAD_BALANCER_NAME }} - run: gcloud compute url-maps invalidate-cdn-cache $LOAD_BALANCER --async --path "/docs/client/*" + SWA_DEPLOY_TOKEN: ${{ secrets.SWA_DEPLOY_TOKEN_PROD }} + run: npx --yes @azure/static-web-apps-cli deploy ./dist --deployment-token "$SWA_DEPLOY_TOKEN" --env production diff --git a/docs/deploy/root-index.html b/docs/deploy/root-index.html new file mode 100644 index 00000000..1b724a7e --- /dev/null +++ b/docs/deploy/root-index.html @@ -0,0 +1,7 @@ + + + + + +Redirecting to client docs... + diff --git a/docs/deploy/staticwebapp.config.prod.json b/docs/deploy/staticwebapp.config.prod.json new file mode 100644 index 00000000..c9f0d0eb --- /dev/null +++ b/docs/deploy/staticwebapp.config.prod.json @@ -0,0 +1,15 @@ +{ + "trailingSlash": "auto", + "forwardingGateway": { + "allowedForwardedHosts": ["dagshub.com"] + }, + "globalHeaders": { + "Referrer-Policy": "strict-origin-when-cross-origin" + }, + "responseOverrides": { + "404": { + "rewrite": "/404.html", + "statusCode": 404 + } + } +} diff --git a/docs/deploy/staticwebapp.config.test.json b/docs/deploy/staticwebapp.config.test.json new file mode 100644 index 00000000..ebc76092 --- /dev/null +++ b/docs/deploy/staticwebapp.config.test.json @@ -0,0 +1,15 @@ +{ + "trailingSlash": "auto", + "forwardingGateway": { + "allowedForwardedHosts": ["test.dagshub.com"] + }, + "globalHeaders": { + "Referrer-Policy": "strict-origin-when-cross-origin" + }, + "responseOverrides": { + "404": { + "rewrite": "/404.html", + "statusCode": 404 + } + } +} From f4cb792f871bcc6ca373326a6f92a16e4e68a64f Mon Sep 17 00:00:00 2001 From: Guy Smoilovsky Date: Mon, 11 May 2026 12:42:56 +0300 Subject: [PATCH 2/3] Unify staticwebapp.config across envs allowedForwardedHosts is just an allowlist for honoring X-Forwarded-Host; the actual incoming host is controlled by which AFD forwards to which SWA. Listing both hosts in one file is safe and avoids per-env drift. --- .github/workflows/docs-publish.yml | 4 ++-- ....config.prod.json => staticwebapp.config.json} | 2 +- docs/deploy/staticwebapp.config.test.json | 15 --------------- 3 files changed, 3 insertions(+), 18 deletions(-) rename docs/deploy/{staticwebapp.config.prod.json => staticwebapp.config.json} (79%) delete mode 100644 docs/deploy/staticwebapp.config.test.json diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml index b3127b89..5a3a1112 100644 --- a/.github/workflows/docs-publish.yml +++ b/.github/workflows/docs-publish.yml @@ -68,7 +68,7 @@ jobs: mkdir -p dist/docs/client cp -r build/html/. dist/docs/client/ cp docs/deploy/root-index.html dist/index.html - cp docs/deploy/staticwebapp.config.test.json dist/staticwebapp.config.json + cp docs/deploy/staticwebapp.config.json dist/staticwebapp.config.json curl -sSf https://test.dagshub.com/this-does-not-exist -o dist/404.html - name: Deploy to test SWA @@ -96,7 +96,7 @@ jobs: mkdir -p dist/docs/client cp -r build/html/. dist/docs/client/ cp docs/deploy/root-index.html dist/index.html - cp docs/deploy/staticwebapp.config.prod.json dist/staticwebapp.config.json + cp docs/deploy/staticwebapp.config.json dist/staticwebapp.config.json curl -sSf https://dagshub.com/this-does-not-exist -o dist/404.html - name: Deploy to prod SWA diff --git a/docs/deploy/staticwebapp.config.prod.json b/docs/deploy/staticwebapp.config.json similarity index 79% rename from docs/deploy/staticwebapp.config.prod.json rename to docs/deploy/staticwebapp.config.json index c9f0d0eb..e0b79caf 100644 --- a/docs/deploy/staticwebapp.config.prod.json +++ b/docs/deploy/staticwebapp.config.json @@ -1,7 +1,7 @@ { "trailingSlash": "auto", "forwardingGateway": { - "allowedForwardedHosts": ["dagshub.com"] + "allowedForwardedHosts": ["dagshub.com", "test.dagshub.com"] }, "globalHeaders": { "Referrer-Policy": "strict-origin-when-cross-origin" diff --git a/docs/deploy/staticwebapp.config.test.json b/docs/deploy/staticwebapp.config.test.json deleted file mode 100644 index ebc76092..00000000 --- a/docs/deploy/staticwebapp.config.test.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "trailingSlash": "auto", - "forwardingGateway": { - "allowedForwardedHosts": ["test.dagshub.com"] - }, - "globalHeaders": { - "Referrer-Policy": "strict-origin-when-cross-origin" - }, - "responseOverrides": { - "404": { - "rewrite": "/404.html", - "statusCode": 404 - } - } -} From 7a0e5427f1d1c6881f7fdfeefdf93bdbc9446607 Mon Sep 17 00:00:00 2001 From: Guy Smoilovsky Date: Mon, 11 May 2026 13:03:18 +0300 Subject: [PATCH 3/3] Check in 404.html instead of fetching at deploy time MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CodeRabbit caught that curl -sSf was treating the intentional 404 response as a failure and would abort the deploy. Rather than fix the flag, just commit the file — it rarely changes and removes runtime network dependency on dagshub.com being up at deploy time. --- .github/workflows/docs-publish.yml | 4 +- docs/deploy/404.html | 2995 ++++++++++++++++++++++++++++ 2 files changed, 2997 insertions(+), 2 deletions(-) create mode 100644 docs/deploy/404.html diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml index 5a3a1112..59ef4c20 100644 --- a/.github/workflows/docs-publish.yml +++ b/.github/workflows/docs-publish.yml @@ -69,7 +69,7 @@ jobs: cp -r build/html/. dist/docs/client/ cp docs/deploy/root-index.html dist/index.html cp docs/deploy/staticwebapp.config.json dist/staticwebapp.config.json - curl -sSf https://test.dagshub.com/this-does-not-exist -o dist/404.html + cp docs/deploy/404.html dist/404.html - name: Deploy to test SWA env: @@ -97,7 +97,7 @@ jobs: cp -r build/html/. dist/docs/client/ cp docs/deploy/root-index.html dist/index.html cp docs/deploy/staticwebapp.config.json dist/staticwebapp.config.json - curl -sSf https://dagshub.com/this-does-not-exist -o dist/404.html + cp docs/deploy/404.html dist/404.html - name: Deploy to prod SWA env: diff --git a/docs/deploy/404.html b/docs/deploy/404.html new file mode 100644 index 00000000..4f6383ec --- /dev/null +++ b/docs/deploy/404.html @@ -0,0 +1,2995 @@ + + + + + + + + + + + + + + + + + + + + + DagsHub Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ + + + + +
+
+
+ +
+
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ +
+
+ +

We couldn't find the page you were looking for

+

Maybe it was moved. Head over to the docs homepage or select another page from the sidebar

+

+ Back to Docs Home +

+
+
+ +
+
+ + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + + + + + + + + \ No newline at end of file