-
-
Notifications
You must be signed in to change notification settings - Fork 52
177 lines (148 loc) · 5.1 KB
/
build-and-release.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: Build, Release & Deploy
on: [push]
env:
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'testing') }}
jobs:
build-webui:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
repository: "pixelit-project/WebUI"
- name: Use Node.js 💾
uses: actions/setup-node@v4
with:
node-version: 19.x
- name: Install dependencies 🔧
run: npm install
- name: Build WebUI 🏗️
run: npm run build
- name: Upload build artifacts 💾
uses: actions/upload-artifact@v3
with:
name: pixelit-webui
path: dist
build-fw:
needs: build-webui
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Cache pip 💾
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO 💾
uses: actions/cache@v3
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python 🐍
uses: actions/setup-python@v4
- name: Download WebUI artifacts 💾
uses: actions/download-artifact@v3
with:
name: pixelit-webui
path: pixelit-webui-artifact
- name: Update webinterface.h 🔧
run: |
python .github/webui.py
- name: Update version in PixelIt.ino 🔧
run: |
python .github/updateversion.py ${{ github.ref_name }}
- name: Install pio and its dependencies 🔧
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio esptool
- name: Run PlatformIO build on selected platforms 🏗️
run: platformio run -e ESP8266_generic -e ESP8266_nodemcuv2 -e ESP32_generic -e ESP32_d1_mini32 -e ESP8266_d1_mini -e ESP32_ulanzi
- name: Merge ESP32 firmware to single binaries 🔧
run: |
python .github/merge.py
- name: Upload build artifacts 💾
uses: actions/upload-artifact@v3
with:
name: pixelit-firmware
path: .pio/build/*/firmware_*.bin
release-fw:
needs: build-fw
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download artifacts 💾
uses: actions/download-artifact@v3
with:
name: pixelit-firmware
- name: Display structure of downloaded files 🔍
run: ls -R
- name: Upload binaries as release 🚀
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./*/firmware_*.bin
tag: ${{ github.ref }}
release_name: ${{ github.ref_name }}
overwrite: true
file_glob: true
prerelease: ${{ env.prerelease }}
upload-fw-to-docs:
needs: build-fw
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
repository: "pixelit-project/PixelIt.Docs"
path: docs
- name: Download artifacts 💾
uses: actions/download-artifact@v3
with:
name: pixelit-firmware
path: artifacts
- name: Prepare binaries for web flasher 🚀
run: |
mkdir -p upload
cp ./docs/src/.vuepress/public/pixelit_flasher/firmware/firmware_*.bin ./upload/
cp -rf ./artifacts/*/firmware_*.bin ./upload/
- name: Display structure of downloaded files 🔍
run: ls -R ./upload/
- name: Upload binaries to PixelIt.Docs for web flasher 🚀
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
with:
source-directory: "upload"
destination-github-username: "pixelit-project"
destination-repository-name: "PixelIt.Docs"
user-email: bot@pixelit
user-name: PixelIt Pipeline Bot
target-branch: master
target-directory: "src/.vuepress/public/pixelit_flasher/firmware/"
commit-message: Pushed binaries from main repo via GitHub Actions
deploy-webui-gh-pages:
runs-on: ubuntu-latest
needs: build-webui
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
repository: "pixelit-project/WebUI"
- name: Download artifacts 💾
uses: actions/download-artifact@v3
with:
name: pixelit-webui
path: webui
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: . # The folder the action should deploy.
clean: false # Automatically remove deleted files from the deploy branch