-
Notifications
You must be signed in to change notification settings - Fork 5
235 lines (205 loc) · 9.05 KB
/
SenhaixFreqWriterBuild.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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
name: Senhaix FreqWriter Build
permissions:
contents: write
actions: write
on:
push:
branches: [ "master" ]
tags: [ "*" ]
pull_request:
branches: [ "master" ]
jobs:
build_macos_x64_plugin:
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: 'recursive'
- name: Setup XCode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Build plugin
run: |
cd ble_plugins && go mod tidy && go build && cp BLEPlugin BLEPlugin_macos_x64 && cp BLEPlugin macOS-ble-helper && chmod +x macOS-ble-helper && \
echo "仅在无法正常使用蓝牙写频功能时使用!\n使用说明:\n1. 下载Release中的“macOS-ble-helper”;\n2. 打开写频软件后双击运行“macOS-ble-helper” ;\n3. 正常使用蓝牙读写频即可" > 说明.txt && \
zip _macOS-ble-helper.zip macOS-ble-helper 说明.txt
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: BLEPlugin_macos_x64
path: ./ble_plugins/BLEPlugin_macos_x64
- name: Release mac x64 Plugin
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./ble_plugins/_macOS-ble-helper.zip
build_windows_plugin:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: 'recursive'
- name: Setup gcc
uses: bwoodsend/setup-winlibs-action@v1
id: winlibs-64
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Run build
shell: pwsh
run: |
cd ble_plugins
set CC=x86_64-w64-mingw32-gcc
set GOARCH=amd64
go mod tidy
go build
mv BLEPlugin.exe BLEPlugin_windows_x64.exe
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: BLEPlugin_windows_x64.exe
path: ./ble_plugins/BLEPlugin_windows_x64.exe
# - name: Release windows x64 Plugin
# uses: softprops/action-gh-release@v2
# if: startsWith(github.ref, 'refs/tags/')
# with:
# files: ./ble_plugins/BLEPlugin_windows_x64.exe
build_linux_plugin:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: 'recursive'
- name: Setup bluez
run: |
sudo apt update && sudo apt install bluez
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Run build
run:
cd ble_plugins && go mod tidy && go build && mv BLEPlugin BLEPlugin_linux_x64
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: BLEPlugin_linux_x64
path: ./ble_plugins/BLEPlugin_linux_x64
build_FreqWriter:
runs-on: windows-latest
needs: [build_linux_plugin,build_windows_plugin,build_macos_x64_plugin]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: 'recursive'
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/[email protected]
- name: Setup Dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Download Artifact
uses: actions/download-artifact@v4
with:
# name: SenhaixFreqWriterArtifacts
path: ./
- name: Build UNIVERSIAL
shell: pwsh
run: |
Invoke-WebRequest -Uri https://cdn.jsdelivr.net/gh/palewire/amateur-satellite-database/data/amsat-all-frequencies.json -OutFile ./amsat-all-frequencies.json
mkdir tmpu
Set-TimeZone -Name "China Standard Time"
$commitHash = git rev-parse --short HEAD
$buildTime = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
$tagName = git describe --tags --abbrev=0 --always || ""
cd Properties
$sourceFile = "./VERSION.cs"
(Get-Content $sourceFile) `
-replace '@COMMIT_HASH@', $commitHash `
-replace '@BUILD_TIME@', $buildTime `
-replace '@TAG_NAME@', $tagName `
| Set-Content $sourceFile
cd ..
dotnet restore -r win-x64
dotnet publish -c Release -r win-x64 /p:PublishSingleFile=true /p:TargetOS=Windows --self-contained true
cd D:/a/senhaix-freq-writer-enhanced/senhaix-freq-writer-enhanced/bin/Release/net6.0-windows10.0.19041.0/win-x64
mkdir senhaix-universial-freq-writer
mv publish/* senhaix-universial-freq-writer
mv D:/a/senhaix-freq-writer-enhanced/senhaix-freq-writer-enhanced/BLEPlugin_windows_x64.exe/BLEPlugin_windows_x64.exe senhaix-universial-freq-writer
cp D:/a/senhaix-freq-writer-enhanced/senhaix-freq-writer-enhanced/amsat-all-frequencies.json senhaix-universial-freq-writer
Compress-Archive -Path .\senhaix-universial-freq-writer -DestinationPath D:\a\senhaix-freq-writer-enhanced\senhaix-freq-writer-enhanced\tmpu\senhaix-universial-freq-writer-Windows-${tagName}.zip
cd D:/a/senhaix-freq-writer-enhanced/senhaix-freq-writer-enhanced/
dotnet restore -r linux-x64
dotnet publish -c Release -r linux-x64 /p:PublishSingleFile=true --self-contained true
cd D:/a/senhaix-freq-writer-enhanced/senhaix-freq-writer-enhanced/bin\Release\net6.0\linux-x64\
mkdir senhaix-universial-freq-writer
mv publish/* senhaix-universial-freq-writer
mv D:/a/senhaix-freq-writer-enhanced/senhaix-freq-writer-enhanced/BLEPlugin_linux_x64/BLEPlugin_linux_x64 senhaix-universial-freq-writer
cp D:/a/senhaix-freq-writer-enhanced/senhaix-freq-writer-enhanced/amsat-all-frequencies.json senhaix-universial-freq-writer
Compress-Archive -Path .\senhaix-universial-freq-writer -DestinationPath D:\a\senhaix-freq-writer-enhanced\senhaix-freq-writer-enhanced\tmpu\senhaix-universial-freq-writer-Linux-${tagName}.zip
cd D:/a/senhaix-freq-writer-enhanced/senhaix-freq-writer-enhanced/
dotnet restore -r osx-x64
dotnet msbuild -t:BundleApp -p:RuntimeIdentifier=osx-x64 -p:UseAppHost=true -property:Configuration=Release
cd D:/a/senhaix-freq-writer-enhanced/senhaix-freq-writer-enhanced/bin\Release\net6.0\osx-x64\
mkdir senhaix-universial-freq-writer
mv D:/a/senhaix-freq-writer-enhanced/senhaix-freq-writer-enhanced/BLEPlugin_macos_x64/BLEPlugin_macos_x64 publish/SenhaixFreqWriter.app/Contents/MacOS
mv D:/a/senhaix-freq-writer-enhanced/senhaix-freq-writer-enhanced/Asset/shx8800-icons/icon.icns publish/SenhaixFreqWriter.app/Contents/Resources
cp D:/a/senhaix-freq-writer-enhanced/senhaix-freq-writer-enhanced/amsat-all-frequencies.json publish/SenhaixFreqWriter.app/Contents/MacOS
mv publish/SenhaixFreqWriter.app senhaix-universial-freq-writer
Compress-Archive -Path .\senhaix-universial-freq-writer -DestinationPath D:\a\senhaix-freq-writer-enhanced\senhaix-freq-writer-enhanced\tmpu\senhaix-universial-freq-writer-macOS-${tagName}.zip
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: SenhaixFreqWriterArtifacts
path: ./tmpu
afterbuild:
needs: build_FreqWriter
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
# name: SenhaixFreqWriterArtifacts
path: ./
- name: Delete Artifact
uses: jimschubert/delete-artifacts-action@v1
with:
min_bytes: '0'
- name: Add Execute
run: |
ls && cd /home/runner/work/senhaix-freq-writer-enhanced/senhaix-freq-writer-enhanced/SenhaixFreqWriterArtifacts && targetName=$(ls | grep senhaix-universial-freq-writer-macOS) && \
echo $targetName && unzip $targetName && rm -rf $targetName && \
chmod +x senhaix-universial-freq-writer/SenhaixFreqWriter.app/Contents/MacOS/BLEPlugin_macos_x64 && \
chmod +x senhaix-universial-freq-writer/SenhaixFreqWriter.app/Contents/MacOS/SenhaixFreqWriter && \
zip -r $targetName senhaix-universial-freq-writer && \
rm -rf senhaix-universial-freq-writer && cd /home/runner/work/senhaix-freq-writer-enhanced/senhaix-freq-writer-enhanced/SenhaixFreqWriterArtifacts && targetName=$(ls | grep senhaix-universial-freq-writer-Linux) && \
echo $targetName && unzip $targetName && rm -rf $targetName && \
chmod +x senhaix-universial-freq-writer/SenhaixFreqWriter && \
chmod +x senhaix-universial-freq-writer/BLEPlugin_linux_x64 && \
zip -r $targetName senhaix-universial-freq-writer
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: SenhaixFreqWriterArtifacts
path: SenhaixFreqWriterArtifacts/*.zip
- name: Release UNIVERSAL
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
SenhaixFreqWriterArtifacts/*.zip