From da7c0a4eae4640cfa94894f8bc2b5fb8f360e008 Mon Sep 17 00:00:00 2001 From: MoX678 Date: Mon, 24 Nov 2025 10:39:52 +0200 Subject: [PATCH 1/8] remove the old --- .github/workflows/deploy.yml | 53 ------------------------------------ 1 file changed, 53 deletions(-) delete mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 177dd90..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Test and Deploy Docusaurus - -on: - workflow_dispatch: - pull_request: - push: - branches: - - master - -jobs: - build: - name: Build Docusaurus - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: npm - - - name: Install dependencies - run: npm ci - - name: Build website - run: npm run build - - - name: Upload Build Artifact - if: github.event_name != 'pull_request' - uses: actions/upload-pages-artifact@v3 - with: - path: build - - deploy: - name: Deploy to GitHub Pages - needs: build - if: github.event_name != 'pull_request' - - # Grant GITHUB_TOKEN the permissions required to make a Pages deployment - permissions: - pages: write # to deploy to Pages - id-token: write # to verify the deployment originates from an appropriate source - - # Deploy to the github-pages environment - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - - runs-on: ubuntu-latest - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 From eb004b0437b2eb0900f6b07ec786a06ef6e87150 Mon Sep 17 00:00:00 2001 From: MoX678 Date: Mon, 24 Nov 2025 11:12:33 +0200 Subject: [PATCH 2/8] trigger preview 1 --- docusaurus.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 17a8182..554e014 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -9,7 +9,7 @@ import { themes as prismThemes } from "prism-react-renderer"; const { themes } = require("prism-react-renderer"); /** @type {import('@docusaurus/types').Config} */ const config = { - title: 'MetaCall Tutorial', + title: 'MetaCall Getting Started', tagline: 'Documentation for MetaCall', favicon: 'img/metacall-logo.png', organizationName: "MetaCall", From 93a8e44da16bb78a577e6595fdb47ff44de04041 Mon Sep 17 00:00:00 2001 From: MoX678 Date: Mon, 24 Nov 2025 11:29:08 +0200 Subject: [PATCH 3/8] Inject dynamic baseUrl into Docusaurus config for pull requests --- .github/workflows/build_preview.yml | 21 +++++++++++++++++++++ docusaurus.config.js | 3 +-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_preview.yml b/.github/workflows/build_preview.yml index 7830d37..481a7e5 100644 --- a/.github/workflows/build_preview.yml +++ b/.github/workflows/build_preview.yml @@ -38,7 +38,28 @@ jobs: - name: Install dependencies run: npm ci + - name: Inject correct baseUrl into docusaurus.config.js + id: inject + run: | + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + BASE_URL="/${{ github.event.repository.name }}/pr-${{ github.event.number }}/" + else + BASE_URL="/${{ github.event.repository.name }}/" + fi + + echo "Using baseUrl=$BASE_URL" + echo "baseUrl=$BASE_URL" >> $GITHUB_OUTPUT + sed -i "s|baseUrl: '.*'|baseUrl: '$BASE_URL'|" docusaurus.config.js + - name: Comment injected baseUrl on PR + if: github.event_name == 'pull_request' + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: docusaurus-baseurl + message: | + ๐Ÿ›  **Docusaurus baseUrl injected** + โžค Base URL set to: `${{ steps.inject.outputs.baseUrl }}` + โœ” Applied to `docusaurus.config.js` successfully. - name: Build Docusaurus site run: npm run build diff --git a/docusaurus.config.js b/docusaurus.config.js index 554e014..8fdcc6f 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -18,11 +18,10 @@ const config = { url: 'https://github.com', // Set the // pathname under which your site is served // For GitHub pages deployment, it is often '//' - baseUrl: '/doc/', + baseUrl: '/docs2/', // GitHub pages deployment config. // If you aren't using GitHub pages, you don't need these. - organizationName: 'metacall', // Usually your GitHub org/user name. projectName: 'doc', // Usually your repo name. deploymentBranch: 'gh-pages', From 7ea6ab5ff62da3ce49dee64a7a0adc7a9fa9df00 Mon Sep 17 00:00:00 2001 From: MoX678 Date: Mon, 24 Nov 2025 16:31:17 +0200 Subject: [PATCH 4/8] Remove redundant checkout step in build preview workflow --- .github/workflows/build_preview.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build_preview.yml b/.github/workflows/build_preview.yml index 481a7e5..497f396 100644 --- a/.github/workflows/build_preview.yml +++ b/.github/workflows/build_preview.yml @@ -75,8 +75,7 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Download build artifact uses: actions/download-artifact@v4 From 85147b269dfd3186558c6825ba90983e4cbddfdd Mon Sep 17 00:00:00 2001 From: MoX678 Date: Mon, 24 Nov 2025 16:39:50 +0200 Subject: [PATCH 5/8] Refactor build preview workflow: rename checkout step and simplify comment message --- .github/workflows/build_preview.yml | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build_preview.yml b/.github/workflows/build_preview.yml index 497f396..317666f 100644 --- a/.github/workflows/build_preview.yml +++ b/.github/workflows/build_preview.yml @@ -20,22 +20,16 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository + - name: Checkout PR branch uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 18 - - name: Cache npm dependencies - uses: actions/cache@v4 - with: - path: ~/.npm - key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }} - restore-keys: | - ${{ runner.os }}-npm- - - name: Install dependencies run: npm ci - name: Inject correct baseUrl into docusaurus.config.js @@ -57,9 +51,9 @@ jobs: with: header: docusaurus-baseurl message: | - ๐Ÿ›  **Docusaurus baseUrl injected** - โžค Base URL set to: `${{ steps.inject.outputs.baseUrl }}` - โœ” Applied to `docusaurus.config.js` successfully. + ๐Ÿ›  **Injected baseUrl** + โžค `${{ steps.inject.outputs.baseUrl }}` + - name: Build Docusaurus site run: npm run build From 297f9c41b6b7fbffc8d3fc70edf10488031e5842 Mon Sep 17 00:00:00 2001 From: MoX678 Date: Mon, 24 Nov 2025 16:49:09 +0200 Subject: [PATCH 6/8] Refactor Docusaurus config: update navigation links to use "to" for internal routes --- docusaurus.config.js | 97 +++++++++++++------------------------------- 1 file changed, 29 insertions(+), 68 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 8fdcc6f..06c1512 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -6,18 +6,15 @@ import { themes as prismThemes } from "prism-react-renderer"; -const { themes } = require("prism-react-renderer"); /** @type {import('@docusaurus/types').Config} */ const config = { title: 'MetaCall Getting Started', tagline: 'Documentation for MetaCall', favicon: 'img/metacall-logo.png', - organizationName: "MetaCall", // Set the production url of your site here url: 'https://github.com', // Set the // pathname under which your site is served - // For GitHub pages deployment, it is often '//' baseUrl: '/docs2/', // GitHub pages deployment config. @@ -61,8 +58,7 @@ const config = { themeConfig: /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ ({ - customCss: './src/css/custom.css', // Correct placement for customCss - // Replace with your project's social card + customCss: './src/css/custom.css', image: 'img/docusaurus-social-card.jpg', navbar: { title: 'Metacall Docs', @@ -77,112 +73,77 @@ const config = { position: 'left', label: 'Documentation', }, + // Use "to" for internal Docusaurus routes { - label: "Install", - href: "/docs/category/installating-metacall-cli", - position: "left", + label: 'Install', + to: '/docs/category/installating-metacall-cli', + position: 'left', }, { - label: "Tutorials", - href: "/docs/category/tutorials", - position: "left", + label: 'Tutorials', + to: '/docs/category/tutorials', + position: 'left', }, { - label: "Google Summer of Code 2025", - href: "/docs/gsoc", - position: "left", + label: 'Google Summer of Code 2025', + to: '/docs/gsoc', + position: 'left', }, { href: '/starred', label: 'โญ Stars', position: 'right', }, - { href: 'https://github.com/metacall', label: 'GitHub', position: 'right', }, - ], }, - + footer: { - style: "dark", + style: 'dark', links: [ { - title: "Intro", + title: 'Intro', items: [ - { - label: "Getting Started", - to: "/docs/getting-started", - }, - { - label: "Install", - to: "/docs/category/installating-metacall-cli", - }, - + { label: 'Getting Started', to: '/docs/getting-started' }, + { label: 'Install', to: '/docs/category/installating-metacall-cli' }, ], }, { - title: "Use MetaCall", + title: 'Use MetaCall', items: [ - { - label: "Tutorials", - to: "/docs/category/tutorials", - }, - { - label: "Deployment", - to: "/docs/deployment", - }, + { label: 'Tutorials', to: '/docs/category/tutorials' }, + { label: 'Deployment', to: '/docs/deployment' }, ], }, { - title: "Community", + title: 'Community', items: [ - { - label: "Discord", - to: "https://discord.gg/upwP4mwJWa", - }, - { - label: "Telegram", - to: "https://t.me/joinchat/BMSVbBatp0Vi4s5l4VgUgg", - }, - { - label: "Matrix", - to: "https://matrix.to/#/#metacall:matrix.org", - }, - + { label: 'Discord', href: 'https://discord.gg/upwP4mwJWa' }, + { label: 'Telegram', href: 'https://t.me/joinchat/BMSVbBatp0Vi4s5l4VgUgg' }, + { label: 'Matrix', href: 'https://matrix.to/#/#metacall:matrix.org' }, ], }, { - title: "More", + title: 'More', items: [ - { - label: "GitHub", - href: "https://github.com/metacall/", - }, - { - label: "Gsoc", - href: "/docs/Gsoc", - }, - - { - label: "Changelog", - href: "https://github.com/metacall/core/releases", - }, - + { label: 'GitHub', href: 'https://github.com/metacall/' }, + { label: 'Gsoc', href: '/docs/Gsoc' }, + { label: 'Changelog', href: 'https://github.com/metacall/core/releases' }, ], }, ], copyright: `Copyright ยฉ ${new Date().getFullYear()} MetaCall. All Rights Reserved.`, }, + prism: { theme: prismThemes.vsDark, darkTheme: prismThemes.vsDark, - }, }), }; -export default config; \ No newline at end of file +export default config; From a9cca8f4686aae5512ca99bb1d4d27372f62a8d4 Mon Sep 17 00:00:00 2001 From: MoX678 Date: Mon, 24 Nov 2025 16:58:13 +0200 Subject: [PATCH 7/8] trigger preview 1 --- docusaurus.config.js | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 06c1512..4362ee6 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -13,21 +13,18 @@ const config = { favicon: 'img/metacall-logo.png', // Set the production url of your site here - url: 'https://github.com', + url: 'https://mox678.github.io', // Set the // pathname under which your site is served baseUrl: '/docs2/', // GitHub pages deployment config. - // If you aren't using GitHub pages, you don't need these. - projectName: 'doc', // Usually your repo name. + organizationName: 'mox678', // your GitHub user/org + projectName: 'docs2', // repo name deploymentBranch: 'gh-pages', onBrokenLinks: 'warn', onBrokenMarkdownLinks: 'warn', - // Even if you don't use internationalization, you can use this field to set - // useful metadata like html lang. For example, if your site is Chinese, you - // may want to replace "en" with "zh-Hans". i18n: { defaultLocale: 'en', locales: ['en'], @@ -40,12 +37,8 @@ const config = { ({ docs: { sidebarPath: './sidebars.js', - - - tagsBasePath: "tags", - breadcrumbs: true, - - + tagsBasePath: 'tags', + breadcrumbs: true, }, theme: { customCss: './src/css/custom.css', @@ -53,8 +46,7 @@ const config = { }), ], ], - - + themeConfig: /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ ({ From 4c53aaa9f57490f035387c99fe3ce79190803f11 Mon Sep 17 00:00:00 2001 From: MoX678 Date: Mon, 24 Nov 2025 17:09:10 +0200 Subject: [PATCH 8/8] Refactor build preview workflow: streamline baseUrl injection and cleanup process --- .github/workflows/build_preview.yml | 35 +++++++++++++++++++---------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build_preview.yml b/.github/workflows/build_preview.yml index 695942d..dd20a1b 100644 --- a/.github/workflows/build_preview.yml +++ b/.github/workflows/build_preview.yml @@ -13,7 +13,6 @@ permissions: id-token: write pull-requests: write - jobs: build: if: github.event.action != 'closed' @@ -32,6 +31,7 @@ jobs: - name: Install dependencies run: npm ci + - name: Inject correct baseUrl into docusaurus.config.js id: inject run: | @@ -45,6 +45,7 @@ jobs: echo "baseUrl=$BASE_URL" >> $GITHUB_OUTPUT sed -i "s|baseUrl: '.*'|baseUrl: '$BASE_URL'|" docusaurus.config.js + - name: Comment injected baseUrl on PR if: github.event_name == 'pull_request' uses: marocchino/sticky-pull-request-comment@v2 @@ -69,8 +70,6 @@ jobs: runs-on: ubuntu-latest steps: - - - name: Download build artifact uses: actions/download-artifact@v4 with: @@ -81,10 +80,10 @@ jobs: id: vars run: | if [[ "${{ github.event_name }}" == "pull_request" ]]; then - echo "branch=pr-${{ github.event.number }}" >> $GITHUB_OUTPUT + echo "destination_dir=pr-${{ github.event.number }}" >> $GITHUB_OUTPUT echo "url=https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr-${{ github.event.number }}/" >> $GITHUB_OUTPUT else - echo "branch=gh-pages" >> $GITHUB_OUTPUT + echo "destination_dir=." >> $GITHUB_OUTPUT echo "url=https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/" >> $GITHUB_OUTPUT fi @@ -93,7 +92,9 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./build - publish_branch: ${{ steps.vars.outputs.branch }} + publish_branch: gh-pages + destination_dir: ${{ steps.vars.outputs.destination_dir }} + keep_files: true # Keep other PR previews intact - name: Comment preview link on PR if: github.event_name == 'pull_request' @@ -109,10 +110,20 @@ jobs: runs-on: ubuntu-latest steps: - - name: Delete preview branch - uses: dawidd6/action-delete-branch@v3 + - name: Checkout gh-pages + uses: actions/checkout@v4 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branches: pr-${{ github.event.pull_request.number }} - soft_fail: true - \ No newline at end of file + ref: gh-pages + + - name: Remove PR preview directory + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + if [ -d "pr-${{ github.event.pull_request.number }}" ]; then + git rm -rf pr-${{ github.event.pull_request.number }} + git commit -m "๐Ÿงน Remove preview for PR #${{ github.event.pull_request.number }}" + git push + else + echo "Directory pr-${{ github.event.pull_request.number }} not found, skipping cleanup" + fi