Skip to content

Add GitHub Actions workflow for CI #5

Add GitHub Actions workflow for CI

Add GitHub Actions workflow for CI #5

Workflow file for this run

---
name: Build firmware
on:
# push:
# branches:
# - main
pull_request:
workflow_dispatch:
workflow_call:
inputs:
release-url:
required: true
type: string
# release:
# types: [published]
concurrency:
# yamllint disable-line rule:line-length
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
RELEASE_URL: ${{ github.server_url }}/${{ github.repository }}/releases/latest
jobs:
build:
name: ${{ matrix.file }}
runs-on: ubuntu-latest
strategy:
max-parallel: 3
matrix:
file:
- onju-voice
- onju-voice-microwakeword
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v4.2.2
- name: 🔨 Build firmware
uses: esphome/build-action@v4.0.3
id: esphome-build
with:
yaml-file: esphome/${{ matrix.file }}.yaml
version: latest
release-summary: "Check the release notes for more information."
release-url: ${{ inputs.release-url || env.RELEASE_URL }}
cache: true
- name: 🚚 Move generated files to output
run: |
mkdir -p output/${{ matrix.file }}
mv ${{ steps.esphome-build.outputs.name }}/* output/${{ matrix.file }}
echo ${{ steps.esphome-build.outputs.version }} > output/${{ matrix.file }}/version
echo ${{ steps.esphome-build.outputs.project-version }} > output/${{ matrix.file }}/project-version
- name: Display the generated files
run: ls -R output
- name: ⬆️ Upload firmware / device artifact
uses: actions/upload-artifact@v4.4.3
with:
name: build-${{ steps.esphome-build.outputs.name }}
path: output
retention-days: 1
consolidate:
name: Consolidate manifests
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
include:
- project: onju-voice
name: Onju Voice
- project: onju-voice-microwakeword
name: Onju Voice Microwakeword
steps:
- name: ⤵️ Download artifacts
uses: actions/download-artifact@v4.1.8
with:
name: build-${{ matrix.project }}-*
merge-multiple: true
path: files
- name: 🔨 Generate combined manifest.json
run: |
version=$(cat files/*/project_version | sort -V | tail -n 1)
jq -s --arg version "$version" '{"name": "${{ matrix.name }}", "version": $version, "home_assistant_domain": "esphome", "builds":.}' files/*/manifest.json > files/manifest.json
- name: 🧪 Display structure of job
run: ls -R
- name: ⬆️ Upload project artifact
uses: actions/upload-artifact@v4.4.3
with:
name: ${{ matrix.project }}
path: files
retention-days: 1