This repository has been archived by the owner on Jan 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
179 lines (152 loc) · 5.42 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
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
name: Release bot
on:
push:
branches:
- main # Trigger on push to the main branch
jobs:
minify:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/[email protected]
- name: Install dependencies
run: |
pip install python-minifier
- name: Minify Python files
run: |
python -c "
import os
import python_minifier
def handle_folder(path):
for file in os.listdir(path):
full_path = os.path.join(path, file)
print('Scan:', file)
if os.path.isdir(full_path):
print('called with:', file)
handle_folder(full_path)
elif file.endswith('.py'):
print('Minify:', file)
with open(full_path, 'r') as f:
content = f.read()
minified_content = python_minifier.minify(content)
with open(full_path, 'w') as f:
f.write(minified_content)
scan_path = './pico_w/Gameberry/'
handle_folder(scan_path)
"
- name: Upload Minified Files
uses: actions/upload-artifact@v3
with:
name: minified-files-pico_w
path: ./pico_w/Gameberry/
json-to-python:
runs-on: ubuntu-latest
needs: minify
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Minified Files
uses: actions/download-artifact@v3
with:
name: minified-files-pico_w
path: ./pico_w/Gameberry/
- name: Setup Python
uses: actions/[email protected]
- name: Clone micropython_data_to_py
run: |
git clone https://github.com/peterhinch/micropython_data_to_py.git
- name: Convert data to python
run: |
./micropython_data_to_py/data_to_py.py ./pico_w/Gameberry/boot_config.json ./pico_w/Gameberry/boot_config.py
./micropython_data_to_py/data_to_py.py ./pico_w/Gameberry/default/settings_default.json ./pico_w/Gameberry/default/settings_default.py
./micropython_data_to_py/data_to_py.py ./pico_w/Gameberry/translations/pl.json ./pico_w/Gameberry/translations/pl.py
./micropython_data_to_py/data_to_py.py ./pico_w/Gameberry/translations/en.json ./pico_w/Gameberry/translations/en.py
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: converted-files-pico_w
path: |
./pico_w/Gameberry/
build:
runs-on: ubuntu-latest
needs: json-to-python
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Minified Files
uses: actions/download-artifact@v3
with:
name: converted-files-pico_w
path: ./pico_w/Gameberry/
- name: Update apt-get
run: |
sudo apt-get update
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential python3 python3-pip libffi-dev pkg-config
pip3 install pyparsing
- name: Clone MicroPython
run: |
git clone --depth 1 https://github.com/micropython/micropython.git
cd micropython
git submodule update --init --recursive
- name: Build mpy-cross
run: |
cd micropython/mpy-cross
make clean
make
cd ..
cd ..
- name: Add boot.py to _boot.py
run: |
cd micropython/ports/rp2
ls ./modules
cat ./modules/_boot.py
cat ./modules/_boot_fat.py
cat /home/runner/work/GameBerry/GameBerry/pico_w/Gameberry/boot.py >> ./modules/_boot.py
cat /home/runner/work/GameBerry/GameBerry/pico_w/Gameberry/boot.py >> ./modules/_boot_fat.py
cat ./modules/_boot.py
cat ./modules/_boot_fat.py
cd ..
cd ..
cd ..
- name: Build Raspberry Pi Pico W
run: |
cd micropython/ports/rp2
make clean
make BOARD=RPI_PICO_W FROZEN_MANIFEST=/home/runner/work/GameBerry/GameBerry/pico_w/Gameberry/manifest.py
- name: Upload Firmware Artifact
uses: actions/upload-artifact@v3
with:
name: pico_w_uf2
path: |
micropython/ports/rp2/build-RPI_PICO_W/firmware.uf2
- name: Get short commit SHA
id: get_short_sha
run: echo "short_sha=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.short_sha }}
release_name: ${{github.sha}}
draft: false
prerelease: true
- uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: micropython/ports/rp2/build-RPI_PICO_W/firmware.uf2
asset_name: RPI_PICO_W.uf2
content_type: application/octet-stream
- uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create_release.outputs.id }}