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
63 changes: 63 additions & 0 deletions .github/workflows/docs-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: docs-pages

on:
push:
branches:
- main
paths:
- 'docs/**'
- '.github/workflows/docs-pages.yml'
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: docs-pages
cancel-in-progress: true

jobs:
build:
name: Build VitePress site
runs-on: ubuntu-latest
defaults:
run:
working-directory: docs
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: docs/package-lock.json

- name: Configure GitHub Pages
uses: actions/configure-pages@v5

- name: Install dependencies
run: npm ci

- name: Build site
run: npm run build

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist

deploy:
name: Deploy GitHub Pages site
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
41 changes: 41 additions & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { defineConfig } from 'vitepress'

const repositoryName = process.env.GITHUB_REPOSITORY?.split('/')[1]
const isGitHubActions = process.env.GITHUB_ACTIONS === 'true'
const isUserSite = repositoryName?.endsWith('.github.io')
const base = isGitHubActions && repositoryName && !isUserSite
? `/${repositoryName}/`
: '/'

// https://vitepress.dev/reference/site-config
export default defineConfig({
base,
title: "CJIT",
description: "C, Just in Time!",
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'CJIT Tutorial', link: '/' },
{ text: 'About Dyne.org', link: 'https://dyne.org' }
],

sidebar: [
{
text: 'Tutorial',
items: [
{ text: 'Get started', link: '/tutorial' },
{ text: 'Graphics', link: '/graphics' },
{ text: 'Sound', link: '/sound' },
{ text: 'Filesystem', link: '/filesystem' },
{ text: 'Terminal UI', link: '/tui' },
{ text: 'Manpage', link: '/manpage' },
{ text: 'FAQs', link: '/faq' }
]
}
],

socialLinks: [
{ icon: 'github', link: 'https://github.com/dyne/cjit' }
]
}
})
9 changes: 9 additions & 0 deletions docs/.vitepress/theme/components/DocBrand.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template>
<div class="doc-brand">
<DyneBrand variant="doc" />
</div>
</template>

<script setup lang="ts">
import DyneBrand from './DyneBrand.vue'
</script>
12 changes: 12 additions & 0 deletions docs/.vitepress/theme/components/DyneBrand.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<template>
<span class="dyne-brand" :class="variant">
<img class="dyne-brand__mark" src="/dyne-mark.svg" alt="Dyne.org" />
<img class="dyne-brand__mark" src="/dyne-logotype.svg" alt="foundation" />
</span>
</template>

<script setup lang="ts">
defineProps<{
variant?: 'nav' | 'doc'
}>()
</script>
21 changes: 21 additions & 0 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// https://vitepress.dev/guide/custom-theme
import { h } from 'vue'
import type { Theme } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import DocBrand from './components/DocBrand.vue'
import DyneBrand from './components/DyneBrand.vue'
import './style.css'

export default {
extends: DefaultTheme,
Layout: () => {
return h(DefaultTheme.Layout, null, {
// https://vitepress.dev/guide/extending-default-theme#layout-slots
'nav-bar-title-before': () => h(DyneBrand, { variant: 'nav' }),
// 'doc-before': () => h(DocBrand)
})
},
enhanceApp({ app, router, siteData }) {
// ...
}
} satisfies Theme
Loading
Loading