Add GitHub Actions workflow for CI #7
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 firmware | |
on: | |
# push: | |
# branches: | |
# - main | |
pull_request: | |
workflow_dispatch: | |
# release: | |
# types: [published] | |
concurrency: | |
# yamllint disable-line rule:line-length | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build firmware | |
uses: esphome/workflows/.github/workflows/build.yml@main | |
with: | |
files: | | |
esphome/onju-voice.yaml | |
esphome/onju-voice-microwakeword.yaml | |
release-summary: "Check the release notes for more information." | |
release-url: ${{ github.server_url }}/${{ github.repository }}/releases/latest | |
consolidate: | |
name: Consolidate firmwares 🚀 | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4.2.2 | |
- name: Download built firmwares | |
uses: actions/download-artifact@v4.1.8 | |
with: | |
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: Copy files | |
run: |- | |
mkdir output | |
cp -R firmwares/* output/ | |
- name: Copy manifest files to root and modify paths | |
run: |- | |
for device in firmwares/*; do | |
device=$(basename $device) | |
jq --arg device "$device" \ | |
'.builds[].ota.path |= $device + "/" + . | (.builds[].parts // [])[].path |= $device + "/" + .' \ | |
firmwares/$device/manifest.json > output/$device-manifest.json | |
done | |
- name: Display files | |
run: ls -R output | |
# - name: Upload GitHub Pages artifact | |
# uses: actions/upload-pages-artifact@v3.0.1 | |
# with: | |
# path: output |