Skip to content

Commit

Permalink
Dynamic Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AzonInc committed Aug 14, 2024
1 parent 66a7132 commit e4d4eec
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 24 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/deploy-pages-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ jobs:
cache: npm # or pnpm / yarn
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Set Version
run: |
version=$(grep 'version:' firmware/base.yaml | awk -F'"' '{print $2}')
version="$version-dev"
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$version\"/" package.json
- name: Install dependencies
run: npm ci
- name: Build with VitePress
Expand All @@ -49,7 +54,7 @@ jobs:
name: Build Doorman Stock Firmware
uses: ./.github/workflows/esphome-build.yml
with:
files: firmware/doorman-stock.dev.yaml
files: firmware/doorman-stock.yaml
name: AzonInc.Doorman-Stock
esphome_version: dev
directory_name: doorman-stock
Expand All @@ -58,7 +63,7 @@ jobs:
name: Build Doorman Nuki Bridge Firmware
uses: ./.github/workflows/esphome-build.yml
with:
files: firmware/doorman-nuki-bridge.dev.yaml
files: firmware/doorman-nuki-bridge.yaml
name: AzonInc.Doorman-Nuki-Bridge
esphome_version: dev
directory_name: doorman-nuki-bridge
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ jobs:
cache: npm # or pnpm / yarn
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Set Version
run: |
version=$(grep 'version:' firmware/base.yaml | awk -F'"' '{print $2}')
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$version\"/" package.json
- name: Install dependencies
run: npm ci
- name: Build with VitePress
Expand Down
16 changes: 15 additions & 1 deletion docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { createRequire } from 'module'
import { defineConfig } from 'vitepress'

const require = createRequire(import.meta.url)
const pkg = require('../../package.json')

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "Doorman",
Expand Down Expand Up @@ -39,7 +43,17 @@ export default defineConfig({
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'Guide', link: '/guide/what-is-doorman' },
{ text: 'Creators', link: '/creators' }
{ text: 'Creators', link: '/creators' },
{
text: pkg.version,
items: [
{
text: !pkg.version.includes('dev') ? 'Switch to Development Docs' : 'Switch to Stable Docs',
link: !pkg.version.includes('dev') ? 'https://doorman-dev.surge.sh/' : 'https://doorman.azon.ai/',
target: '_self'
}
]
}
],

editLink: {
Expand Down
2 changes: 1 addition & 1 deletion docs/firmware/nuki-bridge-firmware.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ There are a few ways to update the firmware:
- Web Serial <Badge type="tip" text="Latest release build, no customization" />

You can connect your Doorman via USB-C and click the button below to install the latest and greatest Doorman Nuki Bridge Firmware right here via Web Serial.
<esp-web-install-button manifest="https://doorman.azon.ai/firmware/release/doorman-nuki-bridge/manifest.json">
<esp-web-install-button manifest="./release/doorman-nuki-bridge/manifest.json">
<button slot="activate">
<div class="custom-layout">
<a class="btn">Install or Update Firmware</a>
Expand Down
2 changes: 1 addition & 1 deletion docs/firmware/stock-firmware.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ There are a few ways to update the firmware:
- Web Serial <Badge type="tip" text="Latest release build, no customization" />

You can connect your Doorman via USB-C and click the button below to install the latest and greatest Doorman Stock Firmware right here via Web Serial.
<esp-web-install-button manifest="https://doorman.azon.ai/firmware/release/doorman-stock/manifest.json">
<esp-web-install-button manifest="./release/doorman-stock/manifest.json">
<button slot="activate">
<div class="custom-layout">
<a class="btn">Install or Update Firmware</a>
Expand Down
2 changes: 1 addition & 1 deletion firmware/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ esphome:

project:
name: "AzonInc.Doorman-Stock"
version: "2024.8.1"
version: "2024.8.1"

platformio_options:
board_build.flash_mode: dio
Expand Down
9 changes: 0 additions & 9 deletions firmware/doorman-nuki-bridge.dev.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions firmware/doorman-stock.dev.yaml

This file was deleted.

19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"name": "doorman",
"version": "2024.8.0",
"devDependencies": {
"@types/node": "^22.3.0",
"vitepress": "^1.3.2"
},
"scripts": {
Expand Down

0 comments on commit e4d4eec

Please sign in to comment.