Loading files
8fd9da023This file is pinned to the selected release. Download the original to open it in your design tool.
name: Update latest build
on:
release:
types: [edited]
workflow_dispatch:
inputs:
version:
description: "Release tag to publish as latest (e.g. 26.6.0)"
required: true
type: string
jobs:
update-latest:
name: Update latest build version
runs-on: ubuntu-latest
environment: production
if: >-
${{ github.event_name == 'workflow_dispatch'
|| (!contains(github.event.release.tag_name, 'beta')
&& github.event.changes.make_latest
&& (github.event.changes.make_latest.to == true
|| github.event.changes.make_latest.to == 'true')) }}
env:
VERSION: ${{ github.event.release.tag_name || inputs.version }}
strategy:
matrix:
device:
- home-assistant-voice
- ha-voice-8mb
steps:
- name: Download version manifest from R2
run: curl -o manifest.json "https://firmware.esphome.io/home-assistant-voice-pe/${{ matrix.device }}/${VERSION}/manifest.json"
- name: Update paths
run: |
mkdir output
jq --arg version "$VERSION" \
'.builds[].ota.path |= $version + "/" + . | (.builds[].parts // [])[].path |= $version + "/" + .' \
manifest.json > output/manifest.json
- name: Upload updated manifest to R2
uses: ryand56/r2-upload-action@b801a390acbdeb034c5e684ff5e1361c06639e7c # v1.4
with:
r2-account-id: ${{ secrets.CLOUDFLARE_R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.CLOUDFLARE_R2_BUCKET }}
source-dir: output
destination-dir: home-assistant-voice-pe/${{ matrix.device }}/