-
Notifications
You must be signed in to change notification settings - Fork 31
117 lines (100 loc) · 3.31 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: PlatformIO build
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare data
run: |
set -x
pushd data
for f in $(curl -sL https://api.github.com/repos/coderus/led-lamp-webui/releases/latest | jq -r '.assets[].browser_download_url'); do curl $f -OL; done
for f in $(curl -sL https://api.github.com/repos/coderus/wifimanager-react-page/releases/latest | jq -r '.assets[].browser_download_url'); do curl $f -OL; done
popd
zip -r data.zip data
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/platformio.ini') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-pio-${{ hashFiles('**/platformio.ini') }}
- name: Set up Python
uses: actions/setup-python@v5
- name: Install PlatformIO
run: |
set -x
python3 -m pip install --upgrade pip
pip3 install --upgrade platformio
- name: Build env esp32dev
run: |
set -x
platformio run -e esp32dev
platformio run -e esp32dev --target buildfs
- name: Build env nodemcu
run: |
set -x
platformio run -e nodemcu
platformio run -e nodemcu --target buildfs
- name: Build env sonoff-r1
run: |
set -x
platformio run -e sonoff-r1
platformio run -e sonoff-r1 --target buildfs
- name: Build env sonoff-r1-4m
run: |
set -x
platformio run -e sonoff-r1-4m
platformio run -e sonoff-r1-4m --target buildfs
- name: Build env esp01s
run: |
set -x
platformio run -e esp01s
platformio run -e esp01s --target buildfs
- name: Prepare artifacts
run: |
set -x
mkdir -p artifacts
cp data.zip artifacts/data.zip
cp .pio/build/esp32dev/firmware.bin artifacts/esp32dev.bin
cp .pio/build/esp32dev/spiffs.bin artifacts/esp32dev-fs.bin
cp .pio/build/nodemcu/firmware.bin artifacts/nodemcu.bin
cp .pio/build/nodemcu/fs.bin artifacts/nodemcu-fs.bin
cp .pio/build/sonoff-r1/firmware.bin artifacts/sonoff-r1.bin
cp .pio/build/sonoff-r1/fs.bin artifacts/sonoff-r1-fs.bin
cp .pio/build/sonoff-r1-4m/firmware.bin artifacts/sonoff-r1-4m.bin
cp .pio/build/sonoff-r1-4m/fs.bin artifacts/sonoff-r1-4m-fs.bin
cp .pio/build/esp01s/firmware.bin artifacts/esp01s.bin
cp .pio/build/esp01s/fs.bin artifacts/esp01s-fs.bin
- name: Upload build result
uses: actions/upload-artifact@v4
with:
name: artifacts
path: artifacts
- name: Create release
if: github.ref == 'refs/heads/master'
run: |
set -x
assets=()
for asset in artifacts/*.bin; do
assets+=("-a" "$asset")
done
for asset in artifacts/*.zip; do
assets+=("-a" "$asset")
done
RELEASE_TAG="$(date +'%Y%m%d%H%M%S')-$(git log --format=%h -1)"
gh release create "$RELEASE_TAG" "${assets[@]}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}