Skip to content

Commit

Permalink
Add GitHub Actions workflow for deployment and documentation build (#95)
Browse files Browse the repository at this point in the history
* Add GitHub Actions workflow for deployment and documentation build

* Enhance GitHub Actions workflow for Docusaurus documentation build and deployment

* Change artifact name

* Show all the files

* Refactor GitHub Actions workflow to consolidate firmware deployment steps

* Download firmware artifacts and clean up intermediate folders

* Enhance deployment workflow to move firmware files and modify manifest paths

* Add path specification for docs artifact download

* Test full deployment cycle

* Set dynamic manifest path

* Change the path

* Refactor firmware installation instructions and enhance deployment workflow

* Add microwakeword firmware file to build workflow

* Run only on release or main branch dispatch
  • Loading branch information
klaasnicolaas authored Oct 29, 2024
1 parent d98bcb5 commit 88e2d61
Show file tree
Hide file tree
Showing 4 changed files with 222 additions and 31 deletions.
110 changes: 110 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
name: Deploy

on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: "The version of the firmware to build"
required: true
type: string
release-url:
description: "Release URL"
required: true
type: string

jobs:
build-firmware:
name: Build Firmware
uses: esphome/workflows/.github/workflows/build.yml@main
with:
files: |
esphome/onju-voice.yaml
esphome/onju-voice-microwakeword.yaml
esphome-version: latest
release-summary: "Check the release notes for more information."
release-url: ${{ github.event_name == 'release' && github.event.release.html_url || (github.event_name == 'workflow_dispatch' && inputs.release-url) || '' }}
release-version: ${{ (github.event_name == 'release' && github.event.release.tag_name) || (github.event_name == 'workflow_dispatch' && inputs.version) || '' }}

build-docs:
name: Build documentation
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected]
- name: 🏗️ Set up Node.js
uses: actions/[email protected]
with:
node-version: 20.x
- name: 🏗️ Install Docusaurus dependencies
run: npm install --frozen-lockfile --non-interactive
working-directory: docs
- name: 🚀 Build Docusaurus
run: npm run build
working-directory: docs
- name: ⬆️ Upload documentation artifact
uses: actions/[email protected]
with:
name: site
path: docs/build

consolidate:
name: Consolidate
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
needs:
- build-firmware
- build-docs
steps:
- name: ⬇️ Download documentation artifact
uses: actions/[email protected]
with:
name: site
path: site
- name: ⬇️ Download firmware artifacts
uses: actions/[email protected]
with:
pattern: onju-voice*
path: firmwares
- name: 🧹 Remove intermediate version folder
run: |-
for d in firmwares/*/*; do
if [ -d "$d" ]; then
mv $d/* $d/../
rm -rf $d
fi
done
- name: 🗂️ Move firmware files to docs
run: |
mkdir output
cp -R site/* output/
cp -R firmwares output/firmware/
# - name: 🧪 Display firmware artifacts
# run: ls -lR
- name: 🧹 Remove documentation artifact
uses: geekyeggo/[email protected]
with:
name: site
- name: ⬆️ Upload pages artifacts
uses: actions/[email protected]
with:
path: output

deploy:
name: Deploy
runs-on: ubuntu-latest
needs: consolidate
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: 🏗️ Setup Github Pages
uses: actions/[email protected]
- name: 🚀 Deploy to Github Pages
uses: actions/[email protected]
id: deployment
31 changes: 3 additions & 28 deletions docs/docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,20 @@ title: Getting Started
description: 'Instructions how to get started with the Onju Voice Satellite'
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import ESPHomeButton from '@site/src/components/ESPWebTools';
import { faUsb } from '@fortawesome/free-brands-svg-icons';
import FirmwareInstallTabs from '@site/src/components/FirmwareInstallTabs';

# Get started

This guide will walk you through the steps needed to set up your Onju Voice PCB with ESPHome. You'll go through the steps of replacing the PCB in the Google Nest mini V2, installing the necessary software, and configuring the settings to get everything up and running smoothly.

## Step 1 - Install firmware

Use the method below to provide your Onju Voice PCB with the correct firmware.

<Tabs>
<TabItem value="usb" label={<><icon icon={faUsb} size="lg"/> USB</>}>
Use the method below to provide your Onju Voice PCB with the correct firmware. Please note that you can use the tabs to select which firmware version you want to install.

_Make sure this page is opened in a Chromium-based browser on a desktop. The software installation does not work with a tablet or phone._

1. Press the blue **connect** button below, a pop-up window will appear with a list of available USB devices.
2. Hold down the `BOOT` button on the Onju Voice PCB ans connect a USB cable.
- _Note_: this prevents the device from reconnecting repeatedly.
3. In the pop-up window, a new entry should appear. Select this USB serial port and click **Connect**.
4. Choose **Install Onju Voice Satellite**, then click **Install**.
5. After installation, click **Next**.
- _Note_: since the device is still in BOOT mode, you'll return to a previous pop-up window.
6. Refresh the browser page.
7. Press the `RST` button on the Onju Voice PCB and repeat steps 1 and 3 to reconnect to the device.
8. In the pop-up window, choose **Connect to Wi-Fi**.
- Add the Onju Voice Satellite to your Wi-Fi network:
- Select your network from the list and enter the credentials for your 2.4 GHz Wi-Fi network.
- Click **Connect**.
- The Onju Voice Satellite is now connected to your network.
- _note_: If you wait to long, the option to connect to Wi-Fi disappears. In that case, repeat step 6 - 8.
9. Congratulations 🎉 You have successfully installed the firmware on your Onju Voice Satellite.
- The LEDs on the Onju Voice PCB should now be blinking green.

<ESPHomeButton />
</TabItem>
</Tabs>
<FirmwareInstallTabs />

## Step 2 - Replace PCB in Google Nest Mini

Expand Down
8 changes: 5 additions & 3 deletions docs/src/components/ESPWebTools.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Head from "@docusaurus/Head";
import React from "react";
import useBaseUrl from "@docusaurus/useBaseUrl";

/**
* Extend JSX.IntrinsicElements to include the custom element
Expand All @@ -27,8 +26,11 @@ const loadEspWebToolsScript = () => (
/>
);

export default function ESPHomeButton() {
const manifestUrl = useBaseUrl("/onju-voice/manifest.json");
interface ESPHomeButtonProps {
manifestUrl: string;
}

export default function ESPHomeButton({ manifestUrl }: ESPHomeButtonProps) {
return (
<>
<Head>{loadEspWebToolsScript()}</Head>
Expand Down
104 changes: 104 additions & 0 deletions docs/src/components/FirmwareInstallTabs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import React from "react";
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import ESPHomeButton from "./ESPWebTools";

/**
* Installation instructions component with dynamic manifest URL.
*/
interface InstallInstructionsProps {
manifestUrl: string;
}

const InstallInstructions: React.FC<InstallInstructionsProps> = ({
manifestUrl,
}) => (
<>
<ol>
<li>
Press the blue <strong>connect</strong> button below, a pop-up window
will appear with a list of available USB devices.
</li>
<li>
Hold down the <code>BOOT</code> button on the Onju Voice PCB and connect
a USB cable.
<ul>
<li>
<em>Note:</em> This prevents the device from reconnecting
repeatedly.
</li>
</ul>
</li>
<li>
In the pop-up window, a new entry should appear. Select this USB serial
port and click <strong>Connect</strong>.
</li>
<li>
Choose <strong>Install Onju Voice Satellite</strong>, then click{" "}
<strong>Install</strong>.
</li>
<li>
After installation, click <strong>Next</strong>.
<ul>
<li>
<em>Note:</em> Since the device is still in BOOT mode, you'll return
to a previous pop-up window.
</li>
</ul>
</li>
<li>Refresh the browser page.</li>
<li>
Press the <code>RST</code> button on the Onju Voice PCB and repeat steps
1 and 3 to reconnect to the device.
</li>
<li>
In the pop-up window, choose <strong>Connect to Wi-Fi</strong>.
<ul>
<li>
Add the Onju Voice Satellite to your Wi-Fi network:
<ul>
<li>
Select your network from the list and enter the credentials for
your 2.4 GHz Wi-Fi network.
</li>
<li>
Click <strong>Connect</strong>.
</li>
<li>
The Onju Voice Satellite is now connected to your network.
</li>
</ul>
</li>
<li>
<em>Note:</em> If you wait too long, the option to connect to Wi-Fi
disappears. In that case, repeat steps 6-8.
</li>
</ul>
</li>
<li>
Congratulations 🎉 You have successfully installed the firmware on your
Onju Voice Satellite.
<ul>
<li>The LEDs on the Onju Voice PCB should now be blinking green.</li>
</ul>
</li>
</ol>
<ESPHomeButton manifestUrl={manifestUrl} />
</>
);

const FirmwareInstallTabs: React.FC = () => (
<Tabs>
<TabItem value="onju-voice" label="Onju Voice">
<InstallInstructions manifestUrl="/onju-voice-satellite/firmware/onju-voice/manifest.json" />
</TabItem>
<TabItem
value="onju-voice-microwakeword"
label="Onju Voice (microWakeWord)"
>
<InstallInstructions manifestUrl="/onju-voice-satellite/firmware/onju-voice-microwakeword/manifest.json" />
</TabItem>
</Tabs>
);

export default FirmwareInstallTabs;

0 comments on commit 88e2d61

Please sign in to comment.