Dial Volume Control #30
Workflow file for this run
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
name: Build ESPHome firmware | |
on: | |
push: | |
branches: | |
- dev | |
pull_request: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
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 | |
id: upload-artifact | |
uses: actions/[email protected] | |
with: | |
path: output | |
name: voice-kit | |
- name: Comment on PR | |
if: github.event_name == 'pull_request' | |
uses: actions/[email protected] | |
with: | |
script: | | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `Firmware built successfully! :tada: | |
[Download][download] and extract the firmware to install with https://web.esphome.io | |
Make sure to choose \`esphome-voice-kit-esp32s3/esphome-voice-kit-esp32s3.factory.bin\`. | |
[download]: ${{ steps.upload-artifact.outputs.artifact-url }}` | |
}) | |
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] |