Skip to content

Senhaix FreqWriter Build #137

Senhaix FreqWriter Build

Senhaix FreqWriter Build #137

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@v4
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