-
Notifications
You must be signed in to change notification settings - Fork 22
116 lines (104 loc) · 3.73 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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:
build-firmware:
name: Build Firmware
uses: esphome/workflows/.github/workflows/[email protected]
with:
files: |
home-assistant-voice.factory.yaml
home-assistant-voice.8mb.yaml
esphome-version: 2024.12.2
release-summary: ${{ github.event_name == 'release' && github.event.release.body || '' }}
release-url: ${{ github.event_name == 'release' && github.event.release.html_url || '' }}
release-version: ${{ github.event_name == 'release' && github.event.release.tag_name || '' }}
comment:
if: github.event_name == 'pull_request'
name: Comment on PR
runs-on: ubuntu-latest
needs:
- build-firmware
steps:
- name: Comment on PR
uses: actions/[email protected]
with:
script: |-
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.runId,
})
const artifact = artifacts['data']['artifacts'].find(a => a.name === 'home-assistant-voice')
const url = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}/artifacts/${artifact['id']}`
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 \`home-assistant-voice-esp32s3.factory.bin\`.
[download]: ${url}`
})
upload-to-r2:
if: github.event_name == 'release'
name: Upload to R2
needs:
- build-firmware
uses: esphome/workflows/.github/workflows/[email protected]
with:
directory: home-assistant-voice-pe
secrets: inherit
summary:
if: github.event_name == 'release'
name: Generate Summary
runs-on: ubuntu-latest
needs:
- upload-to-r2
steps:
- name: Generate
run: |-
echo "## Firmware built successfully!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "[Install here](https://esphome.github.io/home-assistant-voice-pe/?version=${{ github.event.release.tag_name }}) and test **before** approving deployment to beta or production." >> $GITHUB_STEP_SUMMARY
upload-to-release:
name: Upload to Release
if: github.event_name == 'release'
uses: esphome/workflows/.github/workflows/[email protected]
needs:
- build-firmware
with:
version: ${{ github.event.release.tag_name }}
promote-beta:
name: Promote to Beta
if: github.event_name == 'release'
uses: esphome/workflows/.github/workflows/[email protected]
needs:
- upload-to-r2
with:
version: ${{ github.event.release.tag_name }}
directory: home-assistant-voice-pe
channel: beta
manifest-filename: manifest-beta.json
secrets: inherit
promote-prod:
name: Promote to Production
if: github.event_name == 'release' && github.event.release.prerelease == false
uses: esphome/workflows/.github/workflows/[email protected]
needs:
- upload-to-r2
with:
version: ${{ github.event.release.tag_name }}
directory: home-assistant-voice-pe
channel: production
manifest-filename: manifest.json
secrets: inherit