Skip to content

Commit

Permalink
docs: use VitePress (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreDemailly authored Apr 9, 2024
1 parent 154b573 commit d158f33
Show file tree
Hide file tree
Showing 47 changed files with 2,971 additions and 931 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Sample workflow for building and deploying a VitePress site to GitHub Pages
#
name: Deploy VitePress site to Pages

on:
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
# using the `master` branch as the default branch.
push:
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# 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:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
fetch-depth: 0 # Not needed if lastUpdated is not enabled
- name: Setup Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
- name: Setup Pages
uses: actions/configure-pages@1f0c5cde4bc74cd7e1254d0cb4de8d49e9068c7d # v4.0.0
- name: Install dependencies
run: npm install
- name: Build with VitePress
run: npm run docs:build
- name: Upload artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
path: docs/.vitepress/dist

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,5 @@ dist
.pnp.*

src/**/temp
docs/.vitepress/dist
docs/.vitepress/cache
247 changes: 247 additions & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
import { defineConfig } from 'vitepress'

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "Sigyn",
description: "Grafana Loki Alerting Agent",
themeConfig: {
nav: [
{ text: 'Agent', link: '/agent/installation', activeMatch: '^/agent/' },
{ text: 'Config', link: '/config/index', activeMatch: '^/config/' },
{
text: "Utils",
items: [
{ text: 'Logql', link: '/logql/installation', activeMatch: '^/logql/' },
{ text: 'Morphix', link: '/morphix/installation', activeMatch: '^/morphix/' },
{ text: 'Pattern', link: '/pattern/installation', activeMatch: '^/pattern/' },
]
},
{
text: "Notifiers",
items: [
{ text: 'Notifiers', link: '/notifiers/installation', activeMatch: '^/notifiers/' },
{ text: 'Discord', link: '/discord/installation', activeMatch: '^/discord/' },
{ text: 'Slack', link: '/slack/installation', activeMatch: '^/slack/' },
{ text: 'Teams', link: '/teams/installation', activeMatch: '^/teams/' },
]
}
],
search: {
provider: 'local',
},
sidebar: {
"/agent": [
{
text: "Agent",
items: [
{
text: "Installation",
link: "/agent/installation"
},
{
text: "Getting Started",
link: "/agent/getting-started"
},
{
text: "API",
link: "/agent/api"
},
{
text: "Advanced tips",
items: [
{ text: "Testing", link: "/agent/testing" }
]
}
]
}
],
"/config": [
{
text: "Config",
items: [
{
text: "Overview",
link: "/config/",
},
{
text: "Rules",
link: "/config/rules"
},
{
text: "Templates",
link: "/config/templates"
},
{
text: "Composite Rules",
link: "/config/composite-rules"
},
{
text: "Self Monitoring",
link: "/config/self-monitoring"
},
{
text: "Templates",
link: "/config/templates"
},
{
text: "Throttle",
link: "/config/throttle"
},
]
},
{
text: "API",
link: "/config/api"
},
{
text: "Interfaces",
link: "/config/interfaces"
},
{
text: "Advanced",
items: [
{
text: "JSON Schema",
link: "/config/json-schema"
}
]
}
],
"/logql": [
{
text: "Logql",
items: [
{
text: "Installation",
link: "/logql/installation"
},
{
text: "Usage",
link: "/logql/usage"
},
{
text: "API",
items: [
{
text: "Logql",
link: "/logql/LogQL"
},
{
text: "Stream Selector",
link: "/logql/StreamSelector"
},
{
text: "Line Filters",
link: "/logql/LineFilters"
},
{
text: "Label Filters",
link: "/logql/LabelFilters"
},
{
text: "Parser Expression",
link: "/logql/ParserExpression"
}
]
}
]
}
],
"/morphix": [
{
text: "Installation",
link: "/morphix/installation"
},
{
text: "Usage",
link: "/morphix/usage"
},
{
text: "API",
link: "/morphix/api"
},
{
text: "Functions",
link: "/morphix/functions"
},
],
"/pattern": [
{
text: "Installation",
link: "/pattern/installation"
},
{
text: "Usage",
link: "/pattern/usage"
},
{
text: "API",
items: [
{
text: "Pattern",
link: "/pattern/Pattern"
},
{
text: "NoopPattern",
link: "/pattern/NoopPattern"
},
{
text: "Shape",
link: "/pattern/shape"
}
]
},
],
"/discord": [
{
text: "Installation",
link: "/discord/installation"
},
{
text: "Usage",
link: "/discord/usage"
}
],
"/slack": [
{
text: "Installation",
link: "/slack/installation"
},
{
text: "Usage",
link: "/slack/usage"
}
],
"/teams": [
{
text: "Installation",
link: "/teams/installation"
},
{
text: "Usage",
link: "/teams/usage"
}
],
"/notifiers": [
{
text: "Installation",
link: "/notifiers/installation"
},
{
text: "Usage",
link: "/notifiers/usage"
}
]
},
socialLinks: [
{ icon: 'github', link: 'https://github.com/MyUnisoft/sigyn/' }
]
},
base: "/sigyn/",
rewrites: {
":pkg/docs/(.*)": ":pkg/(.*)"
},
srcDir: '../src',
// there is a false positive dead link in /logql/ParserExpression
ignoreDeadLinks: true
})
3 changes: 3 additions & 0 deletions docs/.vitepress/theme/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import DefaultTheme from 'vitepress/theme'
import './main.css'
export default DefaultTheme
52 changes: 52 additions & 0 deletions docs/.vitepress/theme/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
a {
display: inline-block;
}

.VPHero .container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
flex-flow: column-reverse;
margin-top: 150px;
}

.VPHero .container .main {
order: 0 !important;
margin-top: 100px;
}

.VPHero .container .image-container {
transform: none !important;
}

.VPHero.has-image .actions {
justify-content: center !important;
}

kbd {
border: 1px solid rgb(90, 85, 85);
border-radius: 4px;
border-bottom-width: 3px;
padding: 0 6px;
}

.image-container {
width: initial !important;
height: initial !important;
}

@media (min-width: 960px) {
.item.grid-4 {
width: calc(100% / 3) !important;
}
}

.VPHome {
margin-bottom: 0 !important;
}

.VPFeature {
border-radius: 4px !important;
border-bottom: 3px solid rgb(134, 125, 125) !important;
}
25 changes: 25 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
# https://vitepress.dev/reference/default-theme-home-page
layout: home

hero:
name: "Sigyn"
text: "Grafana Loki Alerting Agent"
tagline: My great project tagline
actions:
- theme: brand
text: Markdown Examples
link: /markdown-examples
- theme: alt
text: API Examples
link: /api-examples

features:
- title: Feature A
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
- title: Feature B
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
- title: Feature C
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
---

Loading

0 comments on commit d158f33

Please sign in to comment.