forked from sq5bpf/uvk5-reverse-engineering
-
Notifications
You must be signed in to change notification settings - Fork 13
100 lines (87 loc) · 3.3 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
on:
push:
tags:
- 'v*'
env:
CHIRP_DIR: ${{github.workspace}}\temp\chirp
BASH: C:\tools\cygwin\bin\bash
jobs:
build:
runs-on: windows-latest
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
- name: "Install MSVC"
uses: ilammy/msvc-dev-cmd@v1
- name: "Install Python"
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
cache-dependency-path: 'chirp\requirements-dev.txt'
- name: "Instal Python packages"
run: pip install -r chirp\requirements-dev.txt
- name: "Download PyInstaller"
uses: robinraju/release-downloader@v1.8
with:
repository: "pyinstaller/pyinstaller"
latest: true
zipBall: true
out-file-path: "temp"
extract: true
- name: "Build PyInstaller"
run: >
cd temp\pyinstaller-pyinstaller-*\bootloader &&
python.exe ./waf all --target-arch=64bit &&
cd ..
&& pip install .
- name: "Install Cygwin"
uses: egor-tensin/setup-cygwin@v4
with:
packages: make gettext
- name: "Prepare CHIRP repository"
run: >
New-Item -ItemType Directory -Force -Path temp &&
cd temp &&
git clone https://github.com/kk7ds/chirp.git &&
Copy-Item -Path "${{github.workspace}}\chirp\Makefile" -Destination "${{env.CHIRP_DIR}}\chirp\locale\" -Force &&
Copy-Item -Path "${{github.workspace}}\chirp\chirp.patch" -Destination "${{env.CHIRP_DIR}}\" -Force &&
Copy-Item -Path "${{github.workspace}}\uvk5_egzumer.py" -Destination "${{env.CHIRP_DIR}}\chirp\drivers\" -Force &&
cd chirp &&
git apply chirp.patch;
if ("${{github.ref}}" -like "refs/tags/v*") {
$content = Get-Content -Path "chirp\__init__.py" -Raw;
$content = $content -replace 'CHIRP_VERSION = "py3dev"', "CHIRP_VERSION = `"${{github.ref_name}}`"";
Set-Content -Path "chirp\__init__.py" -Value $content;
}
- name: "Build CHIRP locale"
run: >
${{env.BASH}} --login -c "cd '${{env.CHIRP_DIR}}\chirp\locale'; make" &&
${{env.BASH}} --login -c "cd '${{env.CHIRP_DIR}}'; find chirp/locale/ -maxdepth 1 -type f -delete"
- name: "Build CHIRP"
run: >
cd "${{env.CHIRP_DIR}}" &&
pyinstaller
--noconfirm
--onefile
--windowed
--icon "chirp/share/chirp.ico"
--name "CHIRP_egzumer"
--hidden-import "wx"
--hidden-import "wx._xml"
--hidden-import "importlib-resources"
--add-data "chirp/share;chirp/share/"
--add-data "chirp/stock_configs;chirp/stock_configs/"
--add-data "chirp/locale;chirp/locale/"
--add-data "chirp/drivers;chirp/drivers/"
"chirpwx.py";
- name: Upload onefile to release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{env.CHIRP_DIR}}\dist\CHIRP_egzumer.exe
asset_name: CHIRP_egzumer.exe
tag: ${{ github.ref }}
overwrite: true
release_name: release ${{ github.ref_name }}