-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (66 loc) · 2.88 KB
/
ci_cd.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
name: CI/CD
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- uses: actions/setup-python@v5
- name: Install PlatformIO Core
run: pip install --upgrade platformio
- name: Build PlatformIO Project
run: |
pio run
pio run --target buildfs
- name: Package
if: startsWith(github.ref, 'refs/tags/')
run: |
platformio run -t upload -v 2>/dev/null | grep -e "--chip esp32s3" | awk '{for (i = 1; i <= NF; i++) {if ($i ~ /^0x[0-9a-fA-F]+$/) offset = $i; else if ($i ~ /\.bin$/) {gsub(/^.*\//, "", $i); print offset, $i}}}' > .pio/build/offsets.txt
grep 'storage' partitions.csv | awk -F, '{print $4 " spiffs.bin"}' | sed 's/^ //g' >> .pio/build/offsets.txt
awk '{printf "{\"offset\":\"%s\", \"file\":\"%s\"}\n", $1, $2}' .pio/build/offsets.txt | jq -c -s '.' > .pio/build/offsets.json
- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: |
/home/runner/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin
.pio/build/${{github.event.repository.name}}/bootloader.bin
.pio/build/${{github.event.repository.name}}/firmware.bin
.pio/build/${{github.event.repository.name}}/partitions.bin
.pio/build/${{github.event.repository.name}}/spiffs.bin
.pio/build/offsets.json
token: ${{secrets.ACTION_RELEASE_TOKEN}}
generate_release_notes: true
make_latest: true
- name: GitHubAssistantBot Preprocess
id: preprocess_commits
if: success() || failure()
run: |
commits_json=$(cat <<EOL
${{toJson(github.event.commits)}}
EOL
)
echo "commits=$(echo "$commits_json" | jq -c '[.[] | {message: .message, url: .url}]' || echo "[]")" >> $GITHUB_OUTPUT
- name: GitHubAssistantBot
if: success() || failure()
uses: fjogeleit/http-request-action@v1
with:
url: 'https://node-red.geeken.me/github_assistant_bot'
data: |
{
"key": "${{secrets.ASSISTANT_BOT_KEY}}",
"actor": "${{github.actor}}",
"changes": "https://github.com/${{github.repository}}/commit/${{github.sha}}",
"commits": ${{steps.preprocess_commits.outputs.commits}},
"event": "${{github.event_name}}",
"reference": "${{github.ref_name}}",
"report": "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}",
"repository": "${{github.repository}}",
"status": "${{job.status}}"
}