From c4cad1284694734dbd16cb6d22b6d86e87cabca0 Mon Sep 17 00:00:00 2001 From: fewensa <37804932+fewensa@users.noreply.github.com> Date: Wed, 4 Sep 2024 15:20:13 +0800 Subject: [PATCH] Move to subdir (#51) * Test site url * Disable use_directory_urls * Test * Test * Redirect * Custom vercel.json * Fix redirect * Test * Disable site_url * Update CI * Clean site url * Update site url --- .github/workflows/deploy-dev.yml | 1 + .github/workflows/deploy-prd.yml | 45 +++++++++++++++----------------- .github/workflows/deploy-stg.yml | 2 +- docs/vercel.json | 10 +++++++ mkdocs.yml | 4 ++- 5 files changed, 36 insertions(+), 26 deletions(-) create mode 100644 docs/vercel.json diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 243c8e0..adc79a6 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -37,6 +37,7 @@ jobs: dist_path: site alias_domain: "msgport-docs-dev" script_run: false + vercel_json_path: docs/vercel.json enable_cache: true enable_notify_comment: true enable_notify_slack: true diff --git a/.github/workflows/deploy-prd.yml b/.github/workflows/deploy-prd.yml index ba2b145..34b4ee2 100644 --- a/.github/workflows/deploy-prd.yml +++ b/.github/workflows/deploy-prd.yml @@ -1,27 +1,13 @@ -name: Deploy production with GitHub Pages +name: Deploy production on: push: tags: - "v*" -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: "pages" - cancel-in-progress: false - jobs: deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} + name: Deploy runs-on: ubuntu-latest steps: - name: Fetch latest code @@ -37,12 +23,23 @@ jobs: pip3 install poetry poetry run poetry install --no-root poetry run mkdocs build - - name: Setup Pages - uses: actions/configure-pages@v4 - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 + - name: Setup Vercel environment + uses: actions/checkout@v4 + with: + repository: darwinia-network/devops + path: .github + - name: Deploy to Vercel + uses: ./.github/actions/smart-vercel with: - path: "site" - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 + vercel_token: ${{ secrets.VERCEL_TOKEN }} + vercel_group: itering + preview_output: true + project_name: msgport-docs + prod_mode: true + dist_path: site + script_run: false + vercel_json_path: docs/vercel.json + enable_cache: true + enable_notify_slack: true + slack_channel: darwinia-docs + slack_webhook: ${{ secrets.SLACK_INCOMING_WEBHOOK_URL }} diff --git a/.github/workflows/deploy-stg.yml b/.github/workflows/deploy-stg.yml index d68923f..8c54b0c 100644 --- a/.github/workflows/deploy-stg.yml +++ b/.github/workflows/deploy-stg.yml @@ -29,7 +29,6 @@ jobs: path: .github - name: Deploy to Vercel uses: ./.github/actions/smart-vercel - id: smart-vercel with: vercel_token: ${{ secrets.VERCEL_TOKEN }} vercel_group: itering @@ -38,6 +37,7 @@ jobs: dist_path: site alias_domain: "msgport-docs-stg" script_run: false + vercel_json_path: docs/vercel.json enable_cache: true enable_notify_slack: true slack_channel: darwinia-docs diff --git a/docs/vercel.json b/docs/vercel.json new file mode 100644 index 0000000..ebca6f5 --- /dev/null +++ b/docs/vercel.json @@ -0,0 +1,10 @@ +{ + "trailingSlash": true, + "redirects": [ + { + "source": "/:path((?!docs).*)", + "destination": "/docs/:path*", + "permanent": true + } + ] +} diff --git a/mkdocs.yml b/mkdocs.yml index 972ff19..8c89d4f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,9 +1,11 @@ site_name: Msgport Documentation -site_url: https://docs.msgport.xyz/ +site_url: https://msgport.ringdao.com/docs/ site_description: "This is the official documentation for the Msgport, which is a programmable cross-chain messaging protocol. This site covers the design, usage and integration guide for Msgport." copyright: Copyright © Msgport repo_name: msgport-docs edit_uri: https://github.com/msgport/docs/edit/main/docs +use_directory_urls: false +site_dir: site/docs theme: name: material logo: resource/pics/msgport-logo.svg