forked from tjfenwick/DIY-Sim-Racing-Active-Pedal
-
Notifications
You must be signed in to change notification settings - Fork 23
397 lines (335 loc) · 18.3 KB
/
PreRelease_task.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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
# This is the name of the workflow, visible on GitHub UI.
name: PreRelease_Build_Task
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ develop ]
#pull_request:
# branches: [ main ]
# This is the list of jobs that will be run concurrently.
# Since we use a build matrix, the actual number of jobs
# started depends on how many configurations the matrix
# will produce.
jobs:
Build-date:
runs-on: ubuntu-latest
outputs:
Version_date: ${{ steps.output_version_date.outputs.Version_date }}
Upload_URL: ${{ steps.create-new-PreRelease.outputs.upload_url }}
steps:
# get date
- name: Dynamically set MY_DATE environment variable
run: echo "MY_DATE=$(date +'%Y%m%d.%H%M%S')" >> "$GITHUB_ENV"
- name: Test MY_DATE variable
run: echo ${{ env.MY_DATE }}
- name: output_version_date
id: output_version_date
run: echo "Version_date=Develop_Package_v${{ env.MY_DATE }}" >> "$GITHUB_OUTPUT"
# create a Prerelease
# see https://www.youtube.com/watch?v=_ueJ3LrRqPU
- name: Create PreRelease
id: create-new-PreRelease
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.output_version_date.outputs.Version_date }}
release_name: ${{ steps.output_version_date.outputs.Version_date }}
prerelease: true
BuildFirmware:
#runs-on: ubuntu-latest
runs-on: windows-latest
needs: Build-date
steps:
# Prepare environment
- uses: actions/checkout@main
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install PlatformIO Core
run: pip install --upgrade platformio
# Build ESP code
- name: Build PlatformIO Project ESP32
working-directory: ./ESP32
run: |
pio system info
pio run --environment esp32
pio run --environment esp32s3usbotg
pio run --environment esp32-speedcrafter
pio run --environment esp32s3usbotg-gilphilbert
# copy files to dir
- name: Copy files to packing dir
run: |
copy ${{ github.workspace }}/ESP32/.pio/build/esp32/firmware.bin ${{ github.workspace }}/Helper/bins/esp32
copy ${{ github.workspace }}/ESP32/.pio/build/esp32/bootloader.bin ${{ github.workspace }}/Helper/bins/esp32
copy ${{ github.workspace }}/ESP32/.pio/build/esp32/partitions.bin ${{ github.workspace }}/Helper/bins/esp32
copy ${{ github.workspace }}/ESP32/.pio/build/esp32s3usbotg/firmware.bin ${{ github.workspace }}/Helper/bins/esp32s3
copy ${{ github.workspace }}/ESP32/.pio/build/esp32s3usbotg/bootloader.bin ${{ github.workspace }}/Helper/bins/esp32s3
copy ${{ github.workspace }}/ESP32/.pio/build/esp32s3usbotg/partitions.bin ${{ github.workspace }}/Helper/bins/esp32s3
copy ${{ github.workspace }}/ESP32/.pio/build/esp32-speedcrafter/firmware.bin ${{ github.workspace }}/Helper/bins/esp32_speedcrafter_PCB_V1p4
copy ${{ github.workspace }}/ESP32/.pio/build/esp32-speedcrafter/bootloader.bin ${{ github.workspace }}/Helper/bins/esp32_speedcrafter_PCB_V1p4
copy ${{ github.workspace }}/ESP32/.pio/build/esp32-speedcrafter/partitions.bin ${{ github.workspace }}/Helper/bins/esp32_speedcrafter_PCB_V1p4
copy ${{ github.workspace }}/ESP32/.pio/build/esp32s3usbotg-gilphilbert/firmware.bin ${{ github.workspace }}/Helper/bins/esp32s3_esp32s3usbotg-gilphilbert
copy ${{ github.workspace }}/ESP32/.pio/build/esp32s3usbotg-gilphilbert/bootloader.bin ${{ github.workspace }}/Helper/bins/esp32s3_esp32s3usbotg-gilphilbert
copy ${{ github.workspace }}/ESP32/.pio/build/esp32s3usbotg-gilphilbert/partitions.bin ${{ github.workspace }}/Helper/bins/esp32s3_esp32s3usbotg-gilphilbert
# copy files to dir
- name: List files in dir
run: |
dir ${{ github.workspace }}/Helper/bins/esp32
# zip plugin binaries
- name: ZIP files
run: |
7z a ${{ github.workspace }}/Helper/zip/esp32.zip ${{ github.workspace }}/Helper/bins/esp32/
7z a ${{ github.workspace }}/Helper/zip/esp32s3.zip ${{ github.workspace }}/Helper/bins/esp32s3/
7z a ${{ github.workspace }}/Helper/zip/esp32_speedcrafter.zip ${{ github.workspace }}/Helper/bins/esp32_speedcrafter_PCB_V1p4/
7z a ${{ github.workspace }}/Helper/zip/esp32s3-gilphilbert.zip ${{ github.workspace }}/Helper/bins/esp32s3_esp32s3usbotg-gilphilbert/
# 7z a ./Helper/zip/esp32.zip @./Helper/zip/filelist_esp32.txt
# 7z a ./Helper/zip/esp32s3.zip @Helper/zip/filelist_esp32s3.txt
# 7z a./Helper/zip/esp32_speedcrafter.zip @Helper/zip/filelist_esp32_speedcrafter.txt
# Publish as build artifact
- name: Attach artifact
uses: actions/upload-artifact@v2
with:
name: firmware_esp32
path: |
./Helper/zip/esp32.zip
./Helper/zip/esp32s3.zip
./Helper/zip/esp32_speedcrafter.zip
./Helper/zip/esp32s3-gilphilbert.zip
# Build ESP code for esp32_master
- name: Build PlatformIO Project ESP32
working-directory: ./ESP32_master
run: |
pio system info
pio run --environment esp32s3usbotg
pio run --environment esp32
# copy files to dir
- name: Copy files to packing dir
run: |
copy ${{ github.workspace }}/ESP32_master/.pio/build/esp32s3usbotg/firmware.bin ${{ github.workspace }}/Helper/bins/esp32s3_joystickreceiver
copy ${{ github.workspace }}/ESP32_master/.pio/build/esp32s3usbotg/bootloader.bin ${{ github.workspace }}/Helper/bins/esp32s3_joystickreceiver
copy ${{ github.workspace }}/ESP32_master/.pio/build/esp32s3usbotg/partitions.bin ${{ github.workspace }}/Helper/bins/esp32s3_joystickreceiver
copy ${{ github.workspace }}/ESP32_master/.pio/build/esp32/firmware.bin ${{ github.workspace }}/Helper/bins/esp32_analogout_SC_D15
copy ${{ github.workspace }}/ESP32_master/.pio/build/esp32/bootloader.bin ${{ github.workspace }}/Helper/bins/esp32_analogout_SC_D15
copy ${{ github.workspace }}/ESP32_master/.pio/build/esp32/partitions.bin ${{ github.workspace }}/Helper/bins/esp32_analogout_SC_D15
# zip plugin binaries
- name: ZIP files
run: |
7z a ${{ github.workspace }}/Helper/zip/esp32s3_joystickreceiver.zip ${{ github.workspace }}/Helper/bins/esp32s3_joystickreceiver/
7z a ${{ github.workspace }}/Helper/zip/esp32_analogout_SC_D15.zip ${{ github.workspace }}/Helper/bins/esp32_analogout_SC_D15/
# Build ESP code for esp32_bridge
- name: Build PlatformIO Project ESP_bridge
working-directory: ./ESP_bridge
run: |
pio system info
pio run --environment esp32
# copy files to dir
- name: Copy files to packing dir
run: |
copy ${{ github.workspace }}/ESP_bridge/.pio/build/esp32/firmware.bin ${{ github.workspace }}/Helper/bins/esp32_bridge
copy ${{ github.workspace }}/ESP_bridge/.pio/build/esp32/bootloader.bin ${{ github.workspace }}/Helper/bins/esp32_bridge
copy ${{ github.workspace }}/ESP_bridge/.pio/build/esp32/partitions.bin ${{ github.workspace }}/Helper/bins/esp32_bridge
# zip plugin binaries
- name: ZIP files
run: |
7z a ${{ github.workspace }}/Helper/zip/esp32_bridge.zip ${{ github.workspace }}/Helper/bins/esp32_bridge/
# upload release asset
# Arduino binaries
- name: Upload ESP release assets
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
url: ${{needs.Build-date.outputs.Upload_URL}}
with:
upload_url: ${{ env.url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./Helper/zip/esp32.zip
asset_name: esp32_0.zip
asset_content_type: application/zip
- name: Upload ESP32S3 release assets
id: upload-release-asset-ESP32S3
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
url: ${{needs.Build-date.outputs.Upload_URL}}
with:
upload_url: ${{ env.url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./Helper/zip/esp32s3.zip
asset_name: esp32s3.zip
asset_content_type: application/zip
- name: Upload ESP release assets speedcrafter PCB V1p4
id: upload-release-asset-speedcrafter-pcb-v1p4
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
url: ${{needs.Build-date.outputs.Upload_URL}}
with:
upload_url: ${{ env.url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./Helper/zip/esp32_speedcrafter.zip
asset_name: esp32_speedcrafter.zip
asset_content_type: application/zip
- name: Upload ESP release assets gilphilbert
id: upload-release-asset-esp32s3-gilphilbert
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
url: ${{needs.Build-date.outputs.Upload_URL}}
with:
upload_url: ${{ env.url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./Helper/zip/esp32s3-gilphilbert.zip
asset_name: esp32s3-gilphilbert.zip
asset_content_type: application/zip
- name: Upload ESP release assets esp32s3 espmaster
id: upload-release-asset-ESP32S3-ESPmaster
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
url: ${{needs.Build-date.outputs.Upload_URL}}
with:
upload_url: ${{ env.url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./Helper/zip/esp32s3_joystickreceiver.zip
asset_name: esp32s3_joystickreceiver.zip
asset_content_type: application/zip
- name: Upload ESP release assets esp32s3 espmaster
id: upload-release-asset-esp32_analogout_SC_D15
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
url: ${{needs.Build-date.outputs.Upload_URL}}
with:
upload_url: ${{ env.url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./Helper/zip/esp32_analogout_SC_D15.zip
asset_name: esp32_analogout_SC_D15.zip
asset_content_type: application/zip
- name: Upload ESP release assets esp32s3 espmaster
id: upload-release-asset-esp32_bridge
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
url: ${{needs.Build-date.outputs.Upload_URL}}
with:
upload_url: ${{ env.url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./Helper/zip/esp32_bridge.zip
asset_name: esp32_bridge.zip
asset_content_type: application/zip
########################################################################
# Build SimHub plugin
########################################################################
buildSimhubPlugin:
runs-on: windows-2019
needs: [BuildFirmware, Build-date]
steps:
- uses: actions/checkout@v2
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
- name: Setup NuGet
uses: NuGet/[email protected]
- name: Setup MS Build Systems
uses: microsoft/[email protected]
- uses: actions/cache@v3
name: Restore Caches
id: cache
with:
path: |
innounp050.rar
SimHub.8.01.2.zip
key: SimHub.8.01.2
- name: Download Requirements # Used to download the SimHub DLLs - only if not in cache.
if: steps.cache.outputs.cache-hit != 'true'
run: |
aria2c -j1 -o innounp050.rar "https://sourceforge.net/projects/innounp/files/innounp/innounp%200.50/innounp050.rar/download"
aria2c -j1 -o SimHub.8.01.2.zip "https://github.com/SHWotever/SimHub/releases/download/9.1.22/SimHub.9.01.22.zip"
- name: Extract Requirements # Used to extract the SimHub DLLs
run: |
7z x innounp050.rar
7z x SimHub.8.01.2.zip
dir
mkdir "C:\Program Files (x86)\SimHub\"
${{ github.workspace }}\innounp.exe -v -x -b -e -d"C:\Program Files (x86)\SimHub\" SimHubSetup_9.1.22.exe
- name: List files in dir
run: |
ls "C:\Program Files (x86)\SimHub\"
#- name: List files in dir 2
# run: |
# ls ${{ github.workspace }}
#- name: Edit version
#run: sed -i "s/\(AssemblyVersion(""\([0-9]\+\.\)\{3\}\)\([0-9]\+\)/\1${{github.run_number}}/" "SimHubPlugin/Properties/AssemblyInfo.cs"
- name: Restore Packages
run: nuget restore "SimHubPlugin/User.PluginSdkDemo.sln"
- name: Build solution
run: msbuild "SimHubPlugin/User.PluginSdkDemo.sln" -t:rebuild -property:Configuration=Release
# zip plugin binaries
- name: ZIP files
run: |
7z a ./SimHubPlugin/bin/SimHub_plugin.zip ./SimHubPlugin/bin/*
#- name: List files in dir 3
# run: |
# ls ${{ github.workspace }}/SimHubPlugin
#- name: List files in dir 4
# run: |
# ls ${{ github.workspace }}/SimHubPlugin/bin
# create a release
# see https://www.youtube.com/watch?v=_ueJ3LrRqPU
#- name: Create Release
# id: create-new-release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ github.run_number }}
# release_name: Release ${{ github.run_number }}
# # SimHub plugin binaries
#- name: Upload SimHub release assets
# id: upload-release-asset-plugin
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create-new-release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
# asset_path: ./SimHubPlugin/bin/SimHub_plugin.zip
# asset_name: SimHub_plugin.zip
# asset_content_type: application/zip
# zip plugin binaries
#- uses: montudor/action-zip@v1
# with:
# args: zip -qq -r ./SimHubPlugin/bin/SimHub_plugin.zip ./SimHubPlugin/bin/
#- name: Upload Artifact
# env:
# DATE: ${{needs.Build-date.outputs.Version_date}}
# uses: ncipollo/release-action@v1
# with:
# artifacts: '${{ github.workspace }}\SimHubPlugin\bin\DiyActivePedal.dll'
# prerelease: true
# replacesArtifacts: true
# allowUpdates: true
# name: ${{ env.DATE }}
# tag: ${{ env.DATE }}
- name: Upload Simhub plugin
id: upload-release-asset-simhub_plugin
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
url: ${{needs.Build-date.outputs.Upload_URL}}
with:
upload_url: ${{ env.url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: '${{ github.workspace }}\SimHubPlugin\bin\DiyActivePedal.dll'
asset_name: DiyActivePedal.dll
asset_content_type: application/octet-stream
# SimHub plugin binaries
#- name: Upload SimHub release assets
# id: upload-release-asset-plugin
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create-new-release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
# asset_path: ./SimHubPlugin/bin/SimHub_plugin.zip
# asset_name: SimHub_plugin.zip
# asset_content_type: application/zip