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

Use new shared workflow to publish firmware to Cloudflare R2 #33

Merged
merged 6 commits into from
Aug 2, 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
102 changes: 14 additions & 88 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,103 +1,29 @@
name: Build ESPHome firmware
name: Build

on:
push:
branches:
- dev
pull_request:
workflow_dispatch:
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
yamllint:
name: 🧹 yamllint
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out configuration from GitHub
uses: actions/checkout@v4.1.7
- name: 🚀 Run yamllint
run: yamllint --strict .

build-firmware:
name: Build Firmware
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.7
- name: Build Firmware
uses: esphome/build-action@v3.2.0
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/upload-artifact@v4.3.4
with:
path: output
name: voice-kit

- name: Comment on PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v7.0.1
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/checkout@v4.1.7
- uses: actions/download-artifact@v4.1.8
with:
name: voice-kit
path: output
- run: cp -R static/* output/
- uses: actions/upload-pages-artifact@v3.0.1
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/configure-pages@v5.0.0
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4.0.5
uses: esphome/workflows/.github/workflows/build.yml@main
with:
files: |
voice-kit.yaml
name: voice-kit
esphome-version: 2024.7.3
release-summary: ${{ github.event_name == 'release' && github.event.release.body || '' }}
release-url: ${{ github.event_name == 'release' && github.event.release.html_url || '' }}
upload: ${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/dev') }}
release-version: ${{ github.event_name == 'release' && github.event.release.tag_name || '' }}
secrets: inherit
22 changes: 22 additions & 0 deletions .github/workflows/yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: YAML lint

on:
push:
branches: [main]
paths:
- "**.yaml"
- "**.yml"
pull_request:
paths:
- "**.yaml"
- "**.yml"

jobs:
yamllint:
name: 🧹 yamllint
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out configuration from GitHub
uses: actions/checkout@v4.1.7
- name: 🚀 Run yamllint
run: yamllint --strict .
2 changes: 1 addition & 1 deletion voice-kit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ esphome:
board_build.flash_mode: dio
project:
name: esphome.voice-kit
version: "1.0"
version: dev
on_boot:
priority: 600
then:
Expand Down