forked from verybadsoldier/esp_rgbww_firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (102 loc) · 3.86 KB
/
test-build.yaml
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: Application CI (no cache)
on:
push:
branches: []
pull_request:
branches: []
repository_dispatch:
types: [frontend-build-completed]
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
ref: develop
- name: Install Sming Framework
run: |
cd /opt
git clone https://github.com/SmingHub/Sming.git
cd Sming/Sming
git checkout develop
export SMING_HOME=$(pwd)
../Tools/install.sh Esp8266
../Tools/install.sh Esp32
- name: Get Latest Successful Workflow Run
id: get_run
run: |
latest_run_id=$(curl -s -H "Authorization: token ${{ secrets.artifact_download_token }}" \
"https://api.github.com/repos/pljakobs/esp_rgb_webapp2/actions/runs?status=success&branch=devel" | \
jq -r '.workflow_runs[0].id')
echo "latest_run_id=$latest_run_id" >> $GITHUB_ENV
- name: Download fileList.h artifact
run: |
if [ -f ./include/fileList.h ]; then
rm ./include/fileList.h
fi
artifact_url=$(curl -s -H "Authorization: token ${{ secrets.artifact_download_token }}" \
"https://api.github.com/repos/pljakobs/esp_rgb_webapp2/actions/runs/${{ env.latest_run_id }}/artifacts" | \
jq -r '.artifacts[] | select(.name=="fileList.h") | .archive_download_url')
curl -L -o fileList.h.zip -H "Authorization: token ${{ secrets.artifact_download_token }}" "$artifact_url"
unzip fileList.h.zip -d ./include
- name: Download webapp files artifact
run: |
if [ -d ./webapp ]; then
rm -rf ./webapp
mkdir .webapp
fi
artifact_url=$(curl -s -H "Authorization: token ${{ secrets.artifact_download_token }}" \
"https://api.github.com/repos/pljakobs/esp_rgb_webapp2/actions/runs/${{ env.latest_run_id }}/artifacts" | \
jq -r '.artifacts[] | select(.name=="spa-files") | .archive_download_url')
curl -L -o spa-files.zip -H "Authorization: token ${{ secrets.artifact_download_token }}" "$artifact_url"
unzip spa-files.zip -d ./webapp
build:
needs: setup
runs-on: ubuntu-latest
strategy:
matrix:
soc: [esp8266, esp32, esp32c3]
release: [0, 1]
steps:
- uses: actions/checkout@v2
- name: Set up Sming Environment
run: |
ls /opt
export SMING_HOME=/opt/Sming
- name: Compile Application
env:
SMING_HOME: /opt/Sming/Sming
SMING_SOC: ${{ matrix.soc }}
SMING_RELEASE: ${{ matrix.release }}
run: |
ls /opt/
source $SMING_HOME/../Tools/export.sh
make
- name: Upload firmware artifact
uses: actions/upload-artifact@v4
with:
name: firmware-${{ matrix.soc }}-${{ matrix.release }}
path: out/${{ matrix.soc }}/release/firmware/
- name: Create download page
run: |
mkdir -p dist/download
echo "<html><body><h1>Download Firmware Artifacts</h1><ul>" > dist/download/index.html
for soc in esp8266 esp32 esp32c3; do
for release in 0 1; do
if [ $release -eq 1 ]; then
type="release"
else
type="debug"
fi
echo "<li><a href='firmware-${soc}-${release}.zip'>Download firmware for ${soc} (${type})</a></li>" >> dist/download/index.html
done
done
echo "</ul></body></html>" >> dist/download/index.html
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.pages_token }}
publish_dir: ./dist/download
publish_branch: gh-pages
force_orphan: true