-
-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (118 loc) · 3.89 KB
/
build.yml
File metadata and controls
139 lines (118 loc) · 3.89 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Build ESP-Hosted Firmware
on:
push:
branches: [main]
tags: ['v*']
pull_request:
workflow_dispatch:
inputs:
version:
description: 'ESP-Hosted version to build'
type: string
default: '2.7.0'
release:
description: 'Create a release'
type: boolean
default: true
env:
ESP_IDF_VERSION: v5.5.1
ESP_HOSTED_VERSION: ${{ inputs.version || '2.7.0' }}
jobs:
build:
runs-on: ubuntu-latest
container:
image: espressif/idf:v5.5.1
strategy:
fail-fast: false
matrix:
target:
- esp32
- esp32c5
- esp32c6
- esp32c61
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create project from esp_hosted slave example
run: |
. $IDF_PATH/export.sh
idf.py create-project-from-example "espressif/esp_hosted==${{ env.ESP_HOSTED_VERSION }}:slave"
- name: Build firmware
working-directory: slave
run: |
. $IDF_PATH/export.sh
idf.py set-target ${{ matrix.target }}
idf.py build
- name: Prepare artifacts
run: |
mkdir -p artifacts/${{ env.ESP_HOSTED_VERSION }}
cp slave/build/network_adapter.bin artifacts/${{ env.ESP_HOSTED_VERSION }}/network_adapter_${{ matrix.target }}.bin
sha256sum artifacts/${{ env.ESP_HOSTED_VERSION }}/network_adapter_${{ matrix.target }}.bin > artifacts/${{ env.ESP_HOSTED_VERSION }}/network_adapter_${{ matrix.target }}.bin.sha256
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: firmware-${{ matrix.target }}
path: artifacts/
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') || inputs.release
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: firmware
merge-multiple: true
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ env.ESP_HOSTED_VERSION }}
files: firmware/**/*
generate_release_notes: true
manifest:
needs: release
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
target:
- esp32
- esp32c5
- esp32c6
- esp32c61
steps:
- name: Generate manifest
env:
GH_TOKEN: ${{ github.token }}
run: |
TARGET="${{ matrix.target }}"
REPO="${{ github.repository }}"
# Get all release tags
TAGS=$(gh release list --repo "$REPO" --json tagName -q '.[].tagName')
# Build manifest using jq
echo '{"versions":[]}' > manifest.json
for TAG in $TAGS; do
VERSION="${TAG#v}"
# Get SHA256 from release asset
SHA256_URL="https://github.com/${REPO}/releases/download/${TAG}/${VERSION}/network_adapter_${TARGET}.bin.sha256"
SHA256=$(curl -sL "$SHA256_URL" 2>/dev/null | awk '{print $1}')
if [ -n "$SHA256" ] && [ "$SHA256" != "404:" ]; then
BIN_URL="https://github.com/${REPO}/releases/download/${TAG}/${VERSION}/network_adapter_${TARGET}.bin"
# Add to manifest using jq
jq --arg ver "$VERSION" --arg url "$BIN_URL" --arg sha "$SHA256" \
'.versions += [{"version": $ver, "url": $url, "sha256": $sha}]' \
manifest.json > tmp.json && mv tmp.json manifest.json
fi
done
mv manifest.json ${TARGET}.json
- name: Upload manifest to release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload "v${{ env.ESP_HOSTED_VERSION }}" \
--repo "${{ github.repository }}" \
--clobber \
${{ matrix.target }}.json