-
-
Notifications
You must be signed in to change notification settings - Fork 119
123 lines (101 loc) · 4.41 KB
/
main.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
name: Compile
permissions:
contents: write
on:
push:
branches: [ main ]
paths:
- 'src/**'
- 'lib/**'
jobs:
compile_firmware:
name: Compile the firmware
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v2
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v2
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Install jq
run: sudo apt-get -y install jq
- name: Extract version number
id: version_number
run: |
echo "::set-output name=firmware_version::$(grep '*VERSION' src/Globals.cpp | cut -d'=' -f2 | sed -r 's/"(.*)";/\1/' | awk '{$1=$1};1')"
- name: Create Versionfile
run: echo '${{ steps.version_number.outputs.firmware_version }}' > version
- name: Run PlatformIO for ulanzi
run: pio run --environment ulanzi
- name: Run PlatformIO for awtrix2_upgrade
run: pio run --environment awtrix2_upgrade
- name: Copy firmware for ulanzi to output directory
run: cp .pio/build/ulanzi/firmware.bin docs/ulanzi_flasher/firmware/firmware.bin
- name: Copy firmware for awtrix2_upgrade to output directory
run: cp .pio/build/awtrix2_upgrade/firmware.bin docs/awtrix2_flasher/firmware/firmware.bin
- name: Create new manifest.json for ulanzi
run: cat docs/ulanzi_flasher/firmware/manifest.json | jq '.version="${{ steps.version_number.outputs.firmware_version }}"' > docs/ulanzi_flasher/firmware/new-manifest.json
- name: Override previous manifest.json for ulanzi
run: mv docs/ulanzi_flasher/firmware/new-manifest.json docs/ulanzi_flasher/firmware/manifest.json
- name: Create new manifest.json for awtrix2_upgrade
run: cat docs/awtrix2_flasher/firmware/manifest.json | jq '.version="${{ steps.version_number.outputs.firmware_version }}"' > docs/awtrix2_flasher/firmware/new-manifest.json
- name: Override previous manifest.json for awtrix2_upgrade
run: mv docs/awtrix2_flasher/firmware/new-manifest.json docs/awtrix2_flasher/firmware/manifest.json
- name: Upload ulanzi firmware as artifact
uses: actions/upload-artifact@v2
with:
name: ulanzi_firmware
path: .pio/build/ulanzi/firmware.bin
- name: Upload awtrix2_upgrade firmware as artifact
uses: actions/upload-artifact@v2
with:
name: awtrix2_upgrade_firmware
path: .pio/build/awtrix2_upgrade/firmware.bin
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version_number.outputs.firmware_version }}
release_name: Release ${{ steps.version_number.outputs.firmware_version }}
draft: false
prerelease: false
- name: Upload ulanzi Release Asset
id: upload-ulanzi-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: .pio/build/ulanzi/firmware.bin
asset_name: ulanzi_TC001_${{ steps.version_number.outputs.firmware_version }}.bin
asset_content_type: application/octet-stream
- name: Upload awtrix2_upgrade Release Asset
id: upload-awtrix2_upgrade-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: .pio/build/awtrix2_upgrade/firmware.bin
asset_name: old_awtrix2_conversion_${{ steps.version_number.outputs.firmware_version }}.bin
asset_content_type: application/octet-stream
- name: Commit
id: commit
uses: stefanzweifel/git-auto-commit-action@v4