Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 47 additions & 22 deletions .github/workflows/build_preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,47 @@ permissions:
id-token: write
pull-requests: write


jobs:
build:
if: github.event.action != 'closed'
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
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: |
🛠 **Injected baseUrl**
➤ `${{ steps.inject.outputs.baseUrl }}`

- name: Build Docusaurus site
run: npm run build
Expand All @@ -54,9 +70,6 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Download build artifact
uses: actions/download-artifact@v4
with:
Expand All @@ -67,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

Expand All @@ -79,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'
Expand All @@ -95,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

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
120 changes: 36 additions & 84 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,25 @@

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",

// Set the production url of your site here
url: 'https://github.com',
url: 'https://mox678.github.io',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
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.
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'],
Expand All @@ -44,26 +37,20 @@ const config = {
({
docs: {
sidebarPath: './sidebars.js',


tagsBasePath: "tags",
breadcrumbs: true,


tagsBasePath: 'tags',
breadcrumbs: true,
},
theme: {
customCss: './src/css/custom.css',
},
}),
],
],



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',
Expand All @@ -78,112 +65,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;
export default config;