-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (77 loc) · 2.22 KB
/
main.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
name: CI
on:
- push
- workflow_dispatch
jobs:
firmware:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build firmware
run: |
make build
make asm
cp build/*.asm firmware/
env:
WIFI_SSID: ${{ secrets.WIFI_SSID }}
WIFI_PASSWORD: ${{ secrets.WIFI_PASSWORD }}
- name: Upload firmware
uses: actions/upload-artifact@v3
with:
name: firmware
path: firmware/
release:
runs-on: ubuntu-latest
needs: [firmware]
if: github.ref == 'refs/heads/v1'
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download firmware
uses: actions/download-artifact@v3
with:
name: firmware
path: firmware/
- name: Prepare for release
run: |
tar czf firmware.tgz firmware/
ls -al
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
vsha=${{ github.sha }}
version=$(echo $vsha | cut -b -5)
date=$(date -Idate)
echo $version
gh release create "v1-$version" --latest --title "Release $version" --notes "New firmware version from $date. See flash instructions [on README.md](https://github.com/homebots/vm)" firmware.tgz
flash:
runs-on: ubuntu-latest
needs: [release]
steps:
- name: Download firmware
uses: actions/download-artifact@v3
with:
name: firmware
path: firmware/
- name: Upload to ESP flash
run: |
set -e
curl -sS -X POST ${{ secrets.ESP_LIVE_URL }}/prepare
echo Upload
ls firmware/
for i in $(ls firmware/ -1 | grep '0x'); do
curl -sS ${{ secrets.ESP_LIVE_URL }}/upload/$i --data-binary @firmware/$i;
done
echo Flash
curl -sS -X POST ${{ secrets.ESP_LIVE_URL }}/flash
echo Reset
curl -sS -X POST ${{ secrets.ESP_LIVE_URL }}/reset
sleep 5
echo Reconnect
curl -sS -X POST ${{ secrets.ESP_LIVE_URL }}/connect
echo Completed