-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub Actions workflow for deployment and documentation build (#95)
* 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
1 parent
d98bcb5
commit 88e2d61
Showing
4 changed files
with
222 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |