Skip to content

Commit b4ef36a

Browse files
Merge pull request #4 from ApolloAutomation/AddWeeklyBuildAndDep
Add Weekly Build And Dep. Bot
2 parents 4e66194 + f64ecb0 commit b4ef36a

File tree

4 files changed

+87
-205
lines changed

4 files changed

+87
-205
lines changed

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: "daily"
12+
commit-message:
13+
prefix: "chore(ci): "
14+
groups:
15+
github-actions:
16+
patterns:
17+
- "*"

.github/workflows/build.yml

Lines changed: 10 additions & 193 deletions
Original file line numberDiff line numberDiff line change
@@ -1,204 +1,21 @@
11
name: Publish
2-
env:
3-
DEVICE_NAME: r_pro-1
42

53
on:
64
push:
75
branches:
86
- main
97
paths:
108
- "**.yaml"
11-
# Uncomment if needed:
12-
# workflow_dispatch:
13-
# inputs:
14-
# version:
15-
# description: 'The version of the firmware to build'
16-
# required: true
17-
# release:
18-
# types: [published]
199

20-
jobs:
21-
set-version:
22-
name: Set Version
23-
runs-on: ubuntu-latest
24-
25-
# Expose job-level outputs so other jobs can access them
26-
outputs:
27-
version: ${{ steps.read_version.outputs.version }}
28-
upload_url: ${{ steps.run-release-drafter.outputs.upload_url }}
29-
body: ${{ steps.run-release-drafter.outputs.body }}
30-
html_url: ${{ steps.run-release-drafter.outputs.html_url }}
31-
permissions:
32-
contents: write
33-
pages: write
34-
id-token: write
35-
pull-requests: write
36-
37-
steps:
38-
- name: Checkout code
39-
uses: actions/checkout@v3
40-
41-
- name: Read version from YAML file
42-
id: read_version
43-
run: |
44-
version=$(awk '/substitutions:/ {found=1} found && /version:/ {print $2; exit}' Integrations/ESPHome/Core.yaml | tr -d '"')
45-
echo "version=$version" >> $GITHUB_OUTPUT
46-
echo "Detected version: $version"
47-
48-
- name: Fetch Last Merged PR Body
49-
id: last_pr
50-
env:
51-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52-
run: |
53-
PR_INFO=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
54-
"https://api.github.com/repos/${{ github.repository }}/pulls?state=closed&sort=updated&direction=desc&per_page=1")
55-
PR_BODY=$(echo "$PR_INFO" | jq -r '.[0].body')
56-
echo "$PR_BODY" > pr_body.txt
57-
58-
- name: 🚀 Run Release Drafter
59-
id: run-release-drafter
60-
uses: release-drafter/release-drafter@v6
61-
with:
62-
version: ${{ steps.read_version.outputs.version }}
63-
publish: true
64-
tag: ${{ steps.read_version.outputs.version }}
65-
name: Release ${{ steps.read_version.outputs.version }}
66-
env:
67-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68-
69-
build-firmware-e:
70-
name: Build And Release (Firmware)
71-
uses: esphome/workflows/.github/workflows/build.yml@main
72-
needs:
73-
- set-version
74-
with:
75-
files: |
76-
Integrations/ESPHome/R_PRO-1_ETH.yaml
77-
esphome-version: stable
78-
combined-name: firmware-e
79-
release-summary: ${{ needs.set-version.outputs.body }}
80-
release-version: ${{ needs.set-version.outputs.version }}
81-
82-
build-firmware-w:
83-
name: Build And Release (Firmware W)
84-
uses: esphome/workflows/.github/workflows/build.yml@main
85-
needs:
86-
- set-version
87-
with:
88-
files: |
89-
Integrations/ESPHome/R_PRO-1_W.yaml
90-
esphome-version: stable
91-
combined-name: firmware-w
92-
release-summary: ${{ needs.set-version.outputs.body }}
93-
release-url: ${{ needs.set-version.outputs.html_url }}
94-
release-version: ${{ needs.set-version.outputs.version }}
95-
96-
build-site:
97-
name: Build Site
98-
runs-on: ubuntu-latest
99-
needs:
100-
- build-firmware-e
101-
- build-firmware-w
102-
- set-version
103-
steps:
104-
- name: Checkout source code
105-
uses: actions/checkout@v4
106-
107-
- name: Build
108-
uses: actions/[email protected]
109-
with:
110-
source: ./static
111-
destination: ./output
112-
113-
- name: Upload
114-
uses: actions/upload-artifact@v4
115-
with:
116-
name: site
117-
path: output
10+
permissions:
11+
contents: write
12+
pages: write
13+
id-token: write
14+
pull-requests: write
11815

16+
jobs:
11917
publish:
120-
name: Publish to GitHub Pages
121-
runs-on: ubuntu-latest
122-
needs:
123-
- build-site
124-
- build-firmware-e
125-
- build-firmware-w
126-
- set-version
127-
permissions:
128-
contents: write
129-
pages: write
130-
id-token: write
131-
steps:
132-
- name: Checkout code
133-
uses: actions/checkout@v3
134-
135-
# 1) Download Firmware
136-
- uses: actions/download-artifact@v4
137-
with:
138-
name: firmware-e
139-
path: firmware-e
140-
141-
# 2) Download Firmware-B
142-
- uses: actions/download-artifact@v4
143-
with:
144-
name: firmware-w
145-
path: firmware-w
146-
147-
# 3) Zip them up
148-
- name: Zip firmware
149-
run: |
150-
zip -r firmware-e.zip firmware-e
151-
zip -r firmware-w.zip firmware-w
152-
153-
# 4) Upload firmware.zip as an asset
154-
- name: Upload firmware.zip
155-
id: upload-firmware
156-
uses: actions/upload-release-asset@v1
157-
env:
158-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
159-
with:
160-
# Use the job-level output from set-version:
161-
upload_url: ${{ needs.set-version.outputs.upload_url }}
162-
asset_path: firmware-e.zip
163-
asset_name: firmware-e.zip
164-
asset_content_type: application/zip
165-
166-
# 5) Upload firmware-w.zip
167-
- name: Upload firmware-w.zip
168-
id: upload-firmware-w
169-
uses: actions/upload-release-asset@v1
170-
env:
171-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
172-
with:
173-
# Use the job-level output from set-version:
174-
upload_url: ${{ needs.set-version.outputs.upload_url }}
175-
asset_path: firmware-w.zip
176-
asset_name: firmware-w.zip
177-
asset_content_type: application/zip
178-
179-
- name: Copy firmware and manifest
180-
run: |-
181-
mkdir -p output/firmware-e
182-
cp -r firmware-e/${{ needs.build-firmware-e.outputs.version }}/* output/firmware-e/
183-
184-
- name: Copy firmware and manifest
185-
run: |-
186-
mkdir -p output/firmware-w
187-
cp -r firmware-w/${{ needs.build-firmware-w.outputs.version }}/* output/firmware-w/
188-
189-
- uses: actions/download-artifact@v4
190-
with:
191-
name: site
192-
path: output
193-
194-
- uses: actions/upload-pages-artifact@v3
195-
with:
196-
path: output
197-
retention-days: 1
198-
199-
- name: Setup Pages
200-
uses: actions/configure-pages@v5
201-
202-
- name: Deploy to GitHub Pages
203-
id: deployment
204-
uses: actions/deploy-pages@v4
18+
uses: ApolloAutomation/Workflows/.github/workflows/publish.yml@main
19+
with:
20+
core_yaml_path: Integrations/ESPHome/Core.yaml
21+
firmwares_json: '[{"yaml": "Integrations/ESPHome/R_PRO-1_ETH.yaml", "name": "firmware-e"}, {"yaml": "Integrations/ESPHome/R_PRO-1_W.yaml", "name": "firmware-w"}]'

.github/workflows/ci.yml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,34 @@ name: CI
22

33
on:
44
pull_request:
5-
schedule:
6-
- cron: '0 0 * * 1'
5+
6+
permissions:
7+
# Allow GITHUB_TOKEN to add labels to pull requests
8+
pull-requests: write
9+
issues: write
10+
contents: read
11+
id-token: write
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
15+
cancel-in-progress: true
716

817
jobs:
18+
label-check:
19+
uses: ApolloAutomation/Workflows/.github/workflows/label-check.yml@main
920
ci:
10-
name: Building ${{ matrix.file }}
11-
runs-on: ubuntu-latest
21+
needs: [ label-check ]
1222
strategy:
23+
fail-fast: false
1324
matrix:
1425
file:
15-
- Integrations/ESPHome/R_PRO-1_ETH.yaml
1626
- Integrations/ESPHome/R_PRO-1_W.yaml
27+
- Integrations/ESPHome/R_PRO-1_ETH.yaml
1728
esphome-version:
1829
- stable
1930
- beta
2031
- dev
21-
steps:
22-
- name: Checkout source code
23-
uses: actions/[email protected]
24-
- name: Build ESPHome firmware to verify configuration
25-
uses: esphome/build-action@v6
26-
with:
27-
yaml-file: ${{ matrix.file }}
32+
uses: ApolloAutomation/Workflows/.github/workflows/build.yml@main
33+
with:
34+
file: ${{ matrix.file }}
35+
esphome-version: ${{ matrix.esphome-version }}

.github/workflows/weekly.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Weekly Firmware Build
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * 1'
6+
7+
permissions:
8+
contents: read
9+
id-token: write
10+
11+
jobs:
12+
ci:
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
file:
17+
- Integrations/ESPHome/R_PRO-1_W.yaml
18+
- Integrations/ESPHome/R_PRO-1_ETH.yaml
19+
esphome-version:
20+
- stable
21+
- beta
22+
- dev
23+
uses: ApolloAutomation/Workflows/.github/workflows/build.yml@main
24+
with:
25+
file: ${{ matrix.file }}
26+
esphome-version: ${{ matrix.esphome-version }}
27+
28+
notify:
29+
name: Notify on Failure
30+
needs: [ ci ]
31+
if: failure()
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Send Discord notification
35+
uses: sarisia/actions-status-discord@v1
36+
with:
37+
webhook: ${{ secrets.DISCORD_WEBHOOK }}
38+
status: ${{ needs.ci.result }}
39+
title: Build Failed - ESPHome Firmware
40+
description: One or more ESPHome firmware builds failed. Check the logs for details.

0 commit comments

Comments
 (0)