Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build firmware with gh actions #5

Merged
merged 4 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build ESPHome firmware

on:
push:
branches:
- dev
pull_request:
workflow_dispatch:

jobs:
build-firmware:
name: Build Firmware
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Build Firmware
uses: esphome/[email protected]
id: esphome-build
with:
yaml_file: voice-kit.yaml
version: latest
cache: true
- name: Move generated files to output
run: |
mkdir -p output
mv ${{ steps.esphome-build.outputs.name }} output/
jq --arg version "${{ steps.esphome-build.outputs.project-version }}" \
'{"name": "ESPHome Voice Kit", "version": $version, "home_assistant_domain": "esphome", "new_install_prompt_erase": false, "builds":[.]}' \
output/${{ steps.esphome-build.outputs.name }}/manifest.json > output/manifest.json

- name: Upload firmware
uses: actions/[email protected]
with:
path: output
name: voice-kit

build-pages:
name: Build pages
runs-on: ubuntu-latest
needs:
- build-firmware
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
name: voice-kit
path: output
- run: cp -R static/* output/
- uses: actions/[email protected]
with:
path: output
retention-days: 1

deploy:
# TODO: Change this to `release` later.
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/dev')
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
needs: build-pages
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Setup Pages
uses: actions/[email protected]
- name: Deploy to GitHub Pages
id: deployment
uses: actions/[email protected]
12 changes: 12 additions & 0 deletions static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<html>

<head>
<title>ESPHome Voice Kit</title>
</head>

<body>
<esp-web-install-button manifest="./manifest.json"></esp-web-install-button>
</body>
<script type="module" src="https://unpkg.com/esp-web-tools@10/dist/web/install-button.js?module"></script>

</html>