-
Notifications
You must be signed in to change notification settings - Fork 14
304 lines (298 loc) · 15.7 KB
/
devel_release_firmware.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
name: devel_release_firmware
on:
repository_dispatch:
workflow_dispatch:
push:
paths:
- 'trigger_devel.txt'
# Ensures that only one deploy task per branch/environment will run at a time.
concurrency:
group: environment-${{ github.ref }}
cancel-in-progress: false
jobs:
empty_branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: firmware
- name: Create new empty firmware branch
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git switch --orphan new_branch # create empty branch
git commit --allow-empty -m "Initial commit"
git push -u origin new_branch # push empty branch in repo
git switch firmware
git reset --hard new_branch # reset firmware branch
git push origin firmware -f
git push origin --delete new_branch # delete empty_branch
download:
runs-on: ubuntu-latest
needs: empty_branch
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
ref: firmware
- name: Merge branch main into branch firmware
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git remote add -f mrg_main "https://github.com/tasmota/install.git" --track main
git switch -c work
rm -rf ./github
git merge mrg_main/main --allow-unrelated-histories
- name: Push merged content in branch firmware
uses: ad-m/github-push-action@master
with:
github_token: ${{secrets.GITHUB_TOKEN}}
branch: 'firmware'
- uses: actions/checkout@v3
with:
ref: firmware
- name: Download development firmware artifacts
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: Tasmota_build_devel.yml
repo: arendst/tasmota
name: firmware*
name_is_regexp: true
- name: Move development artifacts in one folder
run: |
mkdir -p ./mv_firmware
rsync -avR ./firmware/./ ./mv_firmware
rsync -avR ./firmware_safeboot/./ ./mv_firmware
rm -rf ./firmware/firmware
rm -rf ./firmware_safeboot
- name: Move development firmware files in sub-folders
run: |
mkdir -p ./firmware/development
mkdir -p ./firmware/development/languages
[ ! -f ./mv_firmware/firmware/tasmota.* ] || mv ./mv_firmware/firmware/tasmota.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota-4M.* ] || mv ./mv_firmware/firmware/tasmota-4M.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota-sensors.* ] || mv ./mv_firmware/firmware/tasmota-sensors.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota-minimal.bin.gz ] || mv ./mv_firmware/firmware/tasmota-minimal.bin.gz ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota-lite.* ] || mv ./mv_firmware/firmware/tasmota-lite.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota-ir*.* ] || mv ./mv_firmware/firmware/tasmota-ir*.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota-display.* ] || mv ./mv_firmware/firmware/tasmota-display.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota-knx.* ] || mv ./mv_firmware/firmware/tasmota-knx.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota-zbbridge.* ] || mv ./mv_firmware/firmware/tasmota-zbbridge.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota-zigbee.* ] || mv ./mv_firmware/firmware/tasmota-zigbee.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota32.* ] || mv ./mv_firmware/firmware/tasmota32.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota32solo1*.* ] || mv ./mv_firmware/firmware/tasmota32solo1*.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota32-ir*.* ] || mv ./mv_firmware/firmware/tasmota32-ir*.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota32-display.* ] || mv ./mv_firmware/firmware/tasmota32-display.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota32-lvgl.* ] || mv ./mv_firmware/firmware/tasmota32-lvgl.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota32-web*.* ] || mv ./mv_firmware/firmware/tasmota32-web*.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota32-odroidgo.* ] || mv ./mv_firmware/firmware/tasmota32-odroidgo.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota32-zbbrdgpro.* ] || mv ./mv_firmware/firmware/tasmota32-zbbrdgpro.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota32-nspanel.* ] || mv ./mv_firmware/firmware/tasmota32-nspanel.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota32-matter.* ] || mv ./mv_firmware/firmware/tasmota32-matter.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota32-core2.* ] || mv ./mv_firmware/firmware/tasmota32-core2.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota32-bluetooth.* ] || mv ./mv_firmware/firmware/tasmota32-bluetooth.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota32c3*.* ] || mv ./mv_firmware/firmware/tasmota32c3*.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota32s2*.* ] || mv ./mv_firmware/firmware/tasmota32s2*.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota32s3*.* ] || mv ./mv_firmware/firmware/tasmota32s3*.* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota32-safeboot* ] || mv ./mv_firmware/firmware/tasmota32-safeboot* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota32-* ] || mv ./mv_firmware/firmware/tasmota32-* ./firmware/development/languages/
[ ! -f ./mv_firmware/firmware/tasmota32* ] || mv ./mv_firmware/firmware/tasmota32* ./firmware/development
[ ! -f ./mv_firmware/firmware/tasmota-minimal.bin ] || rm -rf ./mv_firmware/firmware/tasmota-minimal.bin
[ ! -f ./mv_firmware/firmware/* ] || mv ./mv_firmware/firmware/* ./firmware/development/languages/
rm -rf ./mv_firmware
- name: Download fimrware artifact "special_firmwares"
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: Build_special_firmware.yml
repo: Jason2866/Tasmota-build
name: special*
name_is_regexp: true
- name: Move special firmware files in folder
run: |
mkdir -p ./firmware/unofficial/
mv ./special_firmware/firmware/tasmota* ./firmware/unofficial/
rm -rf ./special_firmware
- name: Update all Manifest files
run: |
mkdir manifest_release
python genManifest.py
#python genManifestWithFeatureas.py
python genManifestRelease.py
- name: Build Tag and commit message
run: |
COMMIT_SHA=$(curl -s "https://api.github.com/repos/arendst/tasmota/commits/development" | jq -r '.sha')
COMMIT="Firmware built from commit https://github.com/arendst/Tasmota/commit/${COMMIT_SHA}"
tag_name_tmp="$(date -I).d.$COMMIT_SHA"
rm release-info.txt 2> /dev/null || echo > /dev/null
rm tag_latest.txt 2> /dev/null || echo > /dev/null
echo "$COMMIT" >> release-info.txt
echo "$tag_name_tmp" >> tag_latest.txt
echo "$tag_name_tmp" >> tag.txt
echo "tag_name=$tag_name_tmp" >> $GITHUB_ENV
- name: Release devel firmwares
uses: jason2866/[email protected]
with:
tag_name: ${{ env.tag_name }}
body_path: release-info.txt
prerelease: true
files: |
tag_latest.txt
tag.txt
manifests_release.json
manifest_release/development*
manifest_release/unofficial*
firmware/development/*
firmware/unofficial/*
env:
GITHUB_TOKEN: ${{ secrets.MASTER_ACCESS_TOKEN }}
- name: Remove not wanted files to be stored in repo
run: |
rm -rf release-info.txt
rm -rf manifests_release.json
rm -rf manifest_release
- name: Push updated devel + special firmware content in branch firmware
run: |
COMMIT_SHA=$(curl -s "https://api.github.com/repos/arendst/tasmota/commits/development" | jq -r '.sha')
COMMIT="Firmware built from commit https://github.com/arendst/Tasmota/commit/${COMMIT_SHA}"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add -A
git commit --allow-empty -m "$COMMIT"
git push origin firmware -f
- name: Download latest release firmwares from release section in github
run: |
gh release download -p "tasmota*" -D gh_latest -R github.com/arendst/tasmota
- name: Move release firmware files in sub-folders
run: |
mkdir -p ./firmware/release/
mkdir -p ./firmware/release/languages
[ ! -f ./gh_latest/tasmota.* ] || mv ./gh_latest/tasmota.* ./firmware/release/
[ ! -f ./gh_latest/tasmota-4M.* ] || mv ./gh_latest/tasmota-4M.* ./firmware/release/
[ ! -f ./gh_latest/tasmota-sensors.* ] || mv ./gh_latest/tasmota-sensors.* ./firmware/release/
[ ! -f ./gh_latest/tasmota-minimal.bin.gz ] || mv ./gh_latest/tasmota-minimal.bin.gz ./firmware/release/
[ ! -f ./gh_latest/tasmota-lite.* ] || mv ./gh_latest/tasmota-lite.* ./firmware/release/
[ ! -f ./gh_latest/tasmota-ir*.* ] || mv ./gh_latest/tasmota-ir*.* ./firmware/release/
[ ! -f ./gh_latest/tasmota-display.* ] || mv ./gh_latest/tasmota-display.* ./firmware/release/
[ ! -f ./gh_latest/tasmota-knx.* ] || mv ./gh_latest/tasmota-knx.* ./firmware/release/
[ ! -f ./gh_latest/tasmota-zbbridge.* ] || mv ./gh_latest/tasmota-zbbridge.* ./firmware/release/
[ ! -f ./gh_latest/tasmota-zigbee.* ] || mv ./gh_latest/tasmota-zigbee.* ./firmware/release/
[ ! -f ./gh_latest/tasmota32.* ] || mv ./gh_latest/tasmota32.* ./firmware/release/
[ ! -f ./gh_latest/tasmota32solo1*.* ] || mv ./gh_latest/tasmota32solo1*.* ./firmware/release/
[ ! -f ./gh_latest/tasmota32-ir*.* ] || mv ./gh_latest/tasmota32-ir*.* ./firmware/release/
[ ! -f ./gh_latest/tasmota32-display.* ] || mv ./gh_latest/tasmota32-display.* ./firmware/release/
[ ! -f ./gh_latest/tasmota32-lvgl.* ] || mv ./gh_latest/tasmota32-lvgl.* ./firmware/release/
[ ! -f ./gh_latest/tasmota32-web*.* ] || mv ./gh_latest/tasmota32-web*.* ./firmware/release/
[ ! -f ./gh_latest/tasmota32-zbbrdgpro.* ] || mv ./gh_latest/tasmota32-zbbrdgpro.* ./firmware/release/
[ ! -f ./gh_latest/tasmota32-matter.* ] || mv ./gh_latest/tasmota32-matter.* ./firmware/release
[ ! -f ./gh_latest/tasmota32-nspanel.* ] || mv ./gh_latest/tasmota32-nspanel.* ./firmware/release/
[ ! -f ./gh_latest/tasmota32-odroidgo.* ] || mv ./gh_latest/tasmota32-odroidgo.* ./firmware/release/
[ ! -f ./gh_latest/tasmota32-core2.* ] || mv ./gh_latest/tasmota32-core2.* ./firmware/release/
[ ! -f ./gh_latest/tasmota32-bluetooth.* ] || mv ./gh_latest/tasmota32-bluetooth.* ./firmware/release/
[ ! -f ./gh_latest/tasmota32c3*.* ] || mv ./gh_latest/tasmota32c3*.* ./firmware/release/
[ ! -f ./gh_latest/tasmota32s2*.* ] || mv ./gh_latest/tasmota32s2*.* ./firmware/release/
[ ! -f ./gh_latest/tasmota32s3*.* ] || mv ./gh_latest/tasmota32s3*.* ./firmware/release/
[ ! -f ./gh_latest/tasmota32-safeboot* ] || mv ./gh_latest/tasmota32-safeboot* ./firmware/release/
[ ! -f ./gh_latest/tasmota32-* ] || mv ./gh_latest/tasmota32-* ./firmware/release/languages/
[ ! -f ./gh_latest/tasmota32* ] || mv ./gh_latest/tasmota32* ./firmware/release/languages/
[ ! -f ./gh_latest/tasmota-minimal.bin ] || rm -rf ./gh_latest/tasmota-minimal.bin
[ ! -f ./gh_latest/* ] || mv ./gh_latest/* ./firmware/release/languages/
rm -rf ./gh_latest
- name: Check for a new Tasmota release
run: |
tag_r_latest=$(<tag_r_latest.txt)
echo $tag_r_latest
Commit=$(curl -s "https://api.github.com/repos/arendst/tasmota/commits/master" | jq -r '.sha')
echo $Commit
sha_r_latest=${tag_r_latest:13}
echo $sha_r_latest
if [ "$Commit" = "$sha_r_latest" ]; then
echo "no_new_release=true" >> $GITHUB_ENV
echo "No new Tasmota release found!"
else
echo "no_new_release=false" >> $GITHUB_ENV
echo "Found a new Tasmota release!"
fi
- name: When a Tasmota release is done -> release firmware
if: env.no_new_release == 'false'
run: |
mkdir manifest_release
python genManifest.py
#python genManifestWithFeatureas.py
python genManifestRelease.py
COMMIT_SHA=$(curl -s "https://api.github.com/repos/arendst/tasmota/commits/master" | jq -r '.sha')
COMMIT="Firmware built from commit https://github.com/arendst/Tasmota/commit/${COMMIT_SHA}"
tag_r_name_tmp="$(date -I).r.$COMMIT_SHA"
rm release-info.txt 2> /dev/null || echo > /dev/null
rm tag_r_latest.txt 2> /dev/null || echo > /dev/null
echo "$COMMIT" >> release-info.txt
echo "$tag_r_name_tmp" >> tag_r_latest.txt
echo "$tag_r_name_tmp" >> tag_r.txt
echo "tag_r_name=$tag_r_name_tmp" >> $GITHUB_ENV
- name: Release firmwares
if: env.no_new_release == 'false'
uses: jason2866/[email protected]
with:
tag_name: ${{ env.tag_r_name }}
body_path: release-info.txt
prerelease: false
files: |
tag_r_latest.txt
tag_r.txt
manifests_release.json
manifest_release/release*
firmware/release/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Remove not wanted files to be stored in repo
if: env.no_new_release == 'false'
run: |
rm -rf release-info.txt
rm -rf manifests_release.json
rm -rf manifest_release
- name: Push release firmwares in branch firmware
run: |
COMMIT_SHA=$(curl -s "https://api.github.com/repos/arendst/tasmota/commits/master" | jq -r '.sha')
COMMIT="Firmware built from commit https://github.com/arendst/Tasmota/commit/${COMMIT_SHA}"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add -A
git commit --allow-empty -m "$COMMIT"
git push origin firmware -f
- name: Push changed tag files in branch main
uses: Jason2866/copy_file_to_another_repo_action@multi_files
env:
API_TOKEN_GITHUB: ${{ secrets.GITHUB_TOKEN }}
with:
source_file: "tag.txt,tag_latest.txt,tag_r.txt,tag_r_latest.txt"
destination_repo: 'tasmota/install'
destination_branch: 'main'
commit_message: "tag updated"
user_email: '41898282+github-actions[bot]@users.noreply.github.com'
user_name: 'github-actions[bot]'
deploy:
needs: download
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: firmware
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1