Skip to content

Update README.md

Update README.md #101

name: ЦУП Альтаир v8 — Windows installer
on:
push:
branches:
- main
pull_request:
branches:
- main
types: [opened, synchronize, reopened]
workflow_dispatch:
permissions:
contents: write
jobs:
build-manual:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Compile v8 LaTeX manual
uses: xu-cheng/latex-action@v4
with:
root_file: CUP_Altair_v8_Manual.tex
working_directory: docs
work_in_root_file_dir: true
latexmk_use_xelatex: true
- name: Upload PDF manual
uses: actions/upload-artifact@v4
with:
name: CUP-Altair-v8-Manual
path: docs/CUP_Altair_v8_Manual.pdf
if-no-files-found: error
retention-days: 30
build-windows:
needs: build-manual
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download compiled PDF manual
uses: actions/download-artifact@v4
with:
name: CUP-Altair-v8-Manual
path: docs
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install PlatformIO
run: python -m pip install --upgrade platformio
- name: Compile ESP32 radio gateway v8
run: pio run -d firmware/ground_station/esp32
- name: Prepare bundled ESP32 firmware
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$buildDir = "firmware/ground_station/esp32/.pio/build/esp32dev"
$sourceCode = Get-Content "firmware/ground_station/esp32/Altair_Ground_ESP32/Altair_Ground_ESP32.ino" -Raw
if ($sourceCode -notmatch 'FW_VERSION\[\]\s*=\s*"([^"]+)"') {
throw "Unable to read FW_VERSION from ESP32 gateway source."
}
$firmwareVersion = $Matches[1]
$bootApp0 = Get-ChildItem "$env:USERPROFILE/.platformio/packages" -Recurse -Filter "boot_app0.bin" | Select-Object -First 1
if (-not $bootApp0) { throw "boot_app0.bin was not found." }
New-Item -ItemType Directory -Force "bundled_firmware" | Out-Null
$images = @(
@{ Source = "$buildDir/bootloader.bin"; File = "gateway-bootloader.bin"; Label = "Bootloader"; Address = 4096 },
@{ Source = "$buildDir/partitions.bin"; File = "gateway-partitions.bin"; Label = "Partition table"; Address = 32768 },
@{ Source = $bootApp0.FullName; File = "gateway-boot_app0.bin"; Label = "boot_app0"; Address = 57344 },
@{ Source = "$buildDir/firmware.bin"; File = "gateway-firmware.bin"; Label = "Altair v8 radio gateway"; Address = 65536 }
)
$manifestImages = @()
foreach ($image in $images) {
if (-not (Test-Path $image.Source)) { throw "Firmware image not found: $($image.Source)" }
$target = Join-Path "bundled_firmware" $image.File
Copy-Item $image.Source $target -Force
$fileInfo = Get-Item $target
$md5 = (Get-FileHash -Algorithm MD5 $target).Hash.ToLowerInvariant()
$manifestImages += [ordered]@{
file=$image.File
label=$image.Label
address=$image.Address
size=$fileInfo.Length
md5=$md5
}
}
$appVersion = (Get-Content package.json -Raw | ConvertFrom-Json).version
$manifest = [ordered]@{
schemaVersion = 1
targetBoard = "ESP32-WROOM-32 / esp32dev"
targetChip = "ESP32"
firmwareVersion = $firmwareVersion
applicationVersion = $appVersion
buildLabel = "Altair MCC v$appVersion / v8-rx203-xor-bypass-rftx"
flashMode = "dio"
flashFreq = "40m"
flashSize = "4MB"
eraseAll = $false
images = $manifestImages
}
$manifest | ConvertTo-Json -Depth 6 | Set-Content "bundled_firmware/manifest.json" -Encoding utf8
- name: Set up Node.js
uses: actions/setup-node@v5
with:
node-version: "22"
- name: Install desktop build dependencies
run: npm install --no-audit --no-fund
- name: Build Windows installer
run: npm run dist:win
- name: Upload v8 artifact
uses: actions/upload-artifact@v4
with:
name: CUP-Altair-v8-Windows-Installer
path: |
release/*.exe
release/*.yml
release/*.blockmap
bundled_firmware/*.json
bundled_firmware/*.bin
firmware/ground_station/esp32/Altair_Ground_ESP32/Altair_Ground_ESP32.ino
docs/CUP_Altair_v8_Manual.pdf
docs/CUP_Altair_v8_Manual.tex
docs/RELEASE_V8.md
if-no-files-found: error
retention-days: 30
- name: Read application version
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
id: app_version
shell: pwsh
run: |
$version = (Get-Content package.json -Raw | ConvertFrom-Json).version
"version=$version" >> $env:GITHUB_OUTPUT
"tag=v$version" >> $env:GITHUB_OUTPUT
- name: Publish GitHub Release v8
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
shell: pwsh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ steps.app_version.outputs.tag }}
run: |
gh release view $env:RELEASE_TAG *> $null
if ($LASTEXITCODE -ne 0) {
$installer = Get-ChildItem -Path release -Filter "CUP-Altair-Setup-*.exe" | Select-Object -First 1
if (-not $installer) { throw "Altair Windows installer was not found in release/." }
gh release create $env:RELEASE_TAG `
$installer.FullName `
"firmware/ground_station/esp32/Altair_Ground_ESP32/Altair_Ground_ESP32.ino" `
"docs/CUP_Altair_v8_Manual.pdf" `
"docs/CUP_Altair_v8_Manual.tex" `
"docs/RELEASE_V8.md" `
"bundled_firmware/gateway-firmware.bin" `
"bundled_firmware/manifest.json" `
--target main `
--title "ЦУП Альтаир v8 ($env:RELEASE_TAG) — Миссия на Луну" `
--notes-file "docs/RELEASE_V8.md" `
--latest
if ($LASTEXITCODE -ne 0) { throw "Unable to publish $env:RELEASE_TAG" }
} else {
Write-Host "Release $env:RELEASE_TAG already exists."
}
- name: Remove previous GitHub releases after v8 is published
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
shell: pwsh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ steps.app_version.outputs.tag }}
run: |
$ErrorActionPreference = "Stop"
gh release view $env:RELEASE_TAG *> $null
if ($LASTEXITCODE -ne 0) { throw "Current release $env:RELEASE_TAG is not published; old releases will not be removed." }
$tags = gh release list --limit 100 --json tagName --jq '.[].tagName'
foreach ($tag in $tags) {
if ($tag -and $tag -ne $env:RELEASE_TAG) {
Write-Host "Deleting old release: $tag"
gh release delete $tag --yes --cleanup-tag
if ($LASTEXITCODE -ne 0) { throw "Unable to delete old release $tag" }
}
}