-
-
Notifications
You must be signed in to change notification settings - Fork 185
100 lines (86 loc) · 3.55 KB
/
build.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
name: Test-build
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
# - feature/cicd-adjusts
jobs:
build_and_release:
name: Build for tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: pip install requests esptool
- name: Install PlatformIO Core
run: |
pip install platformio
platformio update
- name: Build Project
run: |
platformio run
- name: Merge output binaries files
run: |
esptool.py --chip esp32 merge_bin -o .pio/build/m5stack-cplus1_1/release.bin --flash_mode dio --flash_size 4MB 0x1000 .pio/build/m5stack-cplus1_1/bootloader.bin 0x8000 .pio/build/m5stack-cplus1_1/partitions.bin 0x10000 .pio/build/m5stack-cplus1_1/firmware.bin
esptool.py --chip esp32 merge_bin -o .pio/build/m5stack-cplus2/release.bin --flash_mode dio --flash_size 8MB 0x1000 .pio/build/m5stack-cplus2/bootloader.bin 0x8000 .pio/build/m5stack-cplus2/partitions.bin 0x10000 .pio/build/m5stack-cplus2/firmware.bin
esptool.py --chip esp32s3 merge_bin -o .pio/build/m5stack-cardputer/release.bin --flash_mode dio --flash_size 8MB 0x0000 .pio/build/m5stack-cardputer/bootloader.bin 0x8000 .pio/build/m5stack-cardputer/partitions.bin 0x10000 .pio/build/m5stack-cardputer/firmware.bin
- name: Rename release.bin files
run: |
for file in $(find .pio/build/**/ -name 'release.bin'); do
version=$(echo ${{ github.run_number }})
env=$(basename $(dirname "$file"))
new_name="Bruce_${env}_v0.0.$version.bin"
mv "$file" "$(dirname "$file")/$new_name"
done
chmod +r .pio/build/**/Bruce*.bin
ls .pio/build/**/Bruce*.bin
if: github.event_name != 'pull_request'
- name: Upload Binaries
id: upload_binaries_Cplus
uses: actions/upload-artifact@v3
with:
path: .pio/build/m5stack-cplus1_1/Bruce*.bin
if: github.event_name != 'pull_request'
- name: Upload Binaries
id: upload_binaries_Cplus2
uses: actions/upload-artifact@v3
with:
path: .pio/build/m5stack-cplus2/Bruce*.bin
if: github.event_name != 'pull_request'
- name: Upload Binaries_Card
id: upload_binaries
uses: actions/upload-artifact@v3
with:
path: .pio/build/m5stack-cardputer/Bruce*.bin
if: github.event_name != 'pull_request'
#- name: Create Release
# id: create_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.RELEASES_TOKEN }}
# with:
# tag_name: v0.0.${{ github.run_number }}
# release_name: v0.0.${{ github.run_number }}
# draft: true
# prerelease: false
# body: |
# Release automatically generated by CI/CD workflow.
# if: github.event_name != 'pull_request'
#- name: Upload Binaries Release Assets
# run: |
# for file in $(find .pio/build/** -name 'ESP_Web2Sd-Mgr*.bin'); do
# echo "Uploading $file"
# curl \
# -X POST \
# --data-binary @"$file" \
# -H "Authorization: Bearer ${{ secrets.RELEASES_TOKEN }}" \
# -H "Content-Type: application/octet-stream" \
# "${{ steps.create_release.outputs.upload_url }}=$(basename $file)"
# done