Skip to content

Commit

Permalink
ci(docs): set up docs deployment via gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
koebi committed Nov 20, 2023
1 parent 09edc57 commit da6abff
Show file tree
Hide file tree
Showing 7 changed files with 263 additions and 48 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# 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: [vite]

# 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@v3
with:
fetch-depth: 0 # Not needed if lastUpdated is not enabled
# - uses: pnpm/action-setup@v2 # Uncomment this if you're using pnpm
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm # or pnpm / yarn
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Install dependencies
run: npm ci # or pnpm install / yarn install / bun install
- name: Build with VitePress
run: |
npm run docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build
touch docs/.vitepress/dist/.nojekyll
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
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@v2
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ elevation-cache/
cgiar_cache/
node_modules/


# jqwik
.jqwik-database

Expand All @@ -23,3 +24,7 @@ ors-api/src/main/resources/ors-config*

envs/
ors-config-repo/

# docs stuff
docs/.vitepress/dist
docs/.vitepress/cache
29 changes: 29 additions & 0 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { defineConfig } from 'vitepress'

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "openrouteservice backend documentation",
description: "openrouteservice backend documentation",
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'Home', link: '/' },
{ text: 'Examples', link: '/markdown-examples' }
],

sidebar: [
{
text: 'Examples',
items: [
{ text: 'Markdown Examples', link: '/markdown-examples' },
{ text: 'Runtime API Examples', link: '/api-examples' }
]
}
],

socialLinks: [
// TODO: change link
{ icon: 'github', link: 'https://github.com/koebi/openrouteservice' }
]
}
})
49 changes: 49 additions & 0 deletions docs/api-examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
outline: deep
---

# Runtime API Examples

This page demonstrates usage of some of the runtime APIs provided by VitePress.

The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files:

```md
<script setup>
import { useData } from 'vitepress'

const { theme, page, frontmatter } = useData()
</script>

## Results

### Theme Data
<pre>{{ theme }}</pre>

### Page Data
<pre>{{ page }}</pre>

### Page Frontmatter
<pre>{{ frontmatter }}</pre>
```

<script setup>
import { useData } from 'vitepress'

const { site, theme, page, frontmatter } = useData()
</script>

## Results

### Theme Data
<pre>{{ theme }}</pre>

### Page Data
<pre>{{ page }}</pre>

### Page Frontmatter
<pre>{{ frontmatter }}</pre>

## More

Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).
69 changes: 22 additions & 47 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,25 @@
---
title: Home
nav_order: 1
# https://vitepress.dev/reference/default-theme-home-page
layout: home

hero:
name: "openrouteservice backend documentation"
text: "openrouteservice backend documentation"
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
---

# Openrouteservice Backend Documentation

Welcome to the openrouteservice backend documentation.

Here you'll find information on [how to set up the backend
yourself](installation/Installation-and-Usage), what [datasets](Data) are used,
how to [contribute](contributing/Contributing) to the openrouteservice and on
[how openrouteservice works internally](documentation/Documentation).

## API

For any information on how to use the API provided by the openrouteservice,
refer to [the API playground and documentation][apidocs].

## Latest changes

For the latest changes to the openrouteservice, see the human-readable
[CHANGELOG.md][changelog] in the main repo.

## Usage

The fastest way to get to the info you are looking for is **the search bar above**.
If that doesn't work, the sidebar has you covered:

* [Installation and Usage](installation/Installation-and-Usage) contains all
info about setting up the ors locally, whether from
[docker](installation/Running-with-Docker) or from
[source](installation/Building-from-Source). It also contains info about
[configuring openrouteservice](installation/Configuration),
[IDE usage](installation-Opening-Project-in-IntelliJ) and
[more docker stuff](installation/Advanced-Docker-Setup)
* [Data](Data) contains info about the used data sets.
* [Contributing](contributing/Contributing) contains info about contributing to
the openrouteservice, the OpenStreetMap and
[translations](contributing/Contributing-Translations)
* [Documentation](documentation/Documentation) contains all sorts of
explanation about the internal workings of the openrouteservice.
* [FAQ](Frequently-Asked-Questions) contains answers to frequently asked questions.

If you prefer a dark theme, click on the *dark* button next to the search bar.


[apidocs]: https://openrouteservice.org/dev/#/api-docs/v2/directions/{profile}/post
[changelog]: https://github.com/GIScience/openrouteservice/blob/master/CHANGELOG.md

85 changes: 85 additions & 0 deletions docs/markdown-examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Markdown Extension Examples

This page demonstrates some of the built-in markdown extensions provided by VitePress.

## Syntax Highlighting

VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:

**Input**

````
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
````

**Output**

```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```

## Custom Containers

**Input**

```md
::: info
This is an info box.
:::

::: tip
This is a tip.
:::

::: warning
This is a warning.
:::

::: danger
This is a dangerous warning.
:::

::: details
This is a details block.
:::
```

**Output**

::: info
This is an info box.
:::

::: tip
This is a tip.
:::

::: warning
This is a warning.
:::

::: danger
This is a dangerous warning.
:::

::: details
This is a details block.
:::

## More

Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"type": "module",
"devDependencies": {
"vitepress": "^1.0.0-rc.29"
},
"scripts": {
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:preview": "vitepress preview docs"
}
}
}

0 comments on commit da6abff

Please sign in to comment.