Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 162 additions & 0 deletions .github/workflows/desktop_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
name: Desktop Release

permissions:
contents: write

on:
push:
tags:
- 'v*'

env:
RELEASE_ALLOWED_OWNER: 1Blademaster
RELEASE_ALLOWED_ACTOR: 1Blademaster
Comment thread
1Blademaster marked this conversation as resolved.

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false

jobs:
authorize:
name: Authorize Release Actor
runs-on: ubuntu-latest
steps:
- name: Validate release owner and actor
shell: bash
run: |
if [[ "${GITHUB_REPOSITORY_OWNER}" != "${RELEASE_ALLOWED_OWNER}" ]]; then
echo "Release blocked: repository owner '${GITHUB_REPOSITORY_OWNER}' is not '${RELEASE_ALLOWED_OWNER}'."
exit 1
fi

if [[ "${GITHUB_ACTOR}" != "${RELEASE_ALLOWED_ACTOR}" ]]; then
echo "Release blocked: actor '${GITHUB_ACTOR}' is not '${RELEASE_ALLOWED_ACTOR}'."
exit 1
fi

echo "Release authorized for ${GITHUB_ACTOR} on ${GITHUB_REPOSITORY}."

prepare:
name: Prepare Release Metadata
needs: authorize
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.meta.outputs.tag }}
version: ${{ steps.meta.outputs.version }}
prerelease: ${{ steps.meta.outputs.prerelease }}
steps:
- name: Validate tag and extract version
id: meta
shell: bash
run: |
TAG="${GITHUB_REF_NAME}"
VERSION="${TAG#v}"

if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
echo "Invalid release tag: $TAG"
echo "Expected format: vX.Y.Z or vX.Y.Z-suffix"
Comment thread
1Blademaster marked this conversation as resolved.
exit 1
fi

PRERELEASE="false"
# if [[ "$VERSION" == *-* ]] || [[ "$VERSION" == *alpha* ]] || [[ "$VERSION" == *beta* ]] || [[ "$VERSION" == *rc* ]]; then
# PRERELEASE="true"
# fi

echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "prerelease=$PRERELEASE" >> "$GITHUB_OUTPUT"
Comment thread
1Blademaster marked this conversation as resolved.

- name: Create draft release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ steps.meta.outputs.tag }}
name: FGCS ${{ steps.meta.outputs.tag }}
draft: true
prerelease: ${{ steps.meta.outputs.prerelease == 'true' }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build:
name: Build ${{ matrix.name }}
needs: prepare
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Windows x64
os: windows-latest
platform: windows
arch: x64
- name: macOS x64
os: macos-13
platform: mac
arch: x64
- name: macOS arm64
os: macos-latest
platform: mac
arch: arm64
env:
VERSION: ${{ needs.prepare.outputs.version }}
RELEASE_TAG: ${{ needs.prepare.outputs.tag }}

steps:
- name: Check out Git repository
uses: actions/checkout@v6

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 22

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Build on Windows
if: matrix.platform == 'windows'
shell: pwsh
working-directory: building/windows
run: |
python -m venv radio\venv
.\radio\venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install -r radio\requirements.txt
.\building\windows\build.ps1 -Version "$env:VERSION" -Arch "${{ matrix.arch }}"

- name: Build on macOS
if: matrix.platform == 'mac'
shell: bash
working-directory: building/macos
run: |
python3 -m venv radio/venv
source radio/venv/bin/activate
python3 -m pip install --upgrade pip
pip install -r radio/requirements.txt
chmod +x building/macos/build.sh
./building/macos/build.sh "$VERSION" "${{ matrix.arch }}"

- name: Upload Windows installer
if: matrix.platform == 'windows'
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ env.RELEASE_TAG }}
draft: true
files: |
gcs/release/${{ env.VERSION }}/FGCS-Windows-${{ env.VERSION }}-Setup.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload macOS installer
if: matrix.platform == 'mac'
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ env.RELEASE_TAG }}
draft: true
files: |
gcs/release/${{ env.VERSION }}/FGCS-Mac-${{ env.VERSION }}-Installer-${{ matrix.arch }}.dmg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18 changes: 14 additions & 4 deletions building/macos/build.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail

# Build FGCS for macOS (arm64 by default). Run from any directory.
# Usage: ./build.sh [version]
# If no version is provided, the script will show current version and prompt for new one
# Build FGCS for macOS. Run from any directory.
# Usage: ./build.sh [version] [arch]
# version: optional, will prompt if not provided
# arch: optional (x64 or arm64), defaults to host architecture if not specified

VERSION="${1:-}"
ARCH="${2:-}"

echo "Assuming location is FGCS/building/macos"
cd ../../
Expand Down Expand Up @@ -78,6 +80,14 @@ echo "Generated log message descriptions"
cd ../
yarn
yarn version --new-version "$VERSION" --no-git-tag-version --no-commit-hooks
yarn build

# Build with optional arch specification
if [[ -n "$ARCH" ]]; then
echo "Building for architecture: $ARCH"
yarn build --arch="$ARCH"
else
echo "Building for host architecture"
yarn build
fi

echo "Build finished, check gcs/release/${VERSION} for output."
19 changes: 17 additions & 2 deletions building/windows/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

Param (
[Parameter(Mandatory = $false)]
[string]$Version
[string]$Version,
[Parameter(Mandatory = $false)]
[string]$Arch
)

Write-Output "Assuming location is FGCS\building\windows"
Expand Down Expand Up @@ -98,6 +100,11 @@ if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to generate param definitions"
exit $LASTEXITCODE
}

# Check for second argument (arch) via $Arch parameter
if (-not $Arch) {
$Arch = ""
}
Write-Output "Generated param definitions"

python generate_log_message_descriptions.py
Expand All @@ -110,7 +117,15 @@ Write-Output "Generated log message descriptions"
Set-Location ../
yarn
yarn version --new-version $Version --no-git-tag-version --no-commit-hooks
yarn build

# Build with optional arch specification
if ($Arch) {
Write-Output "Building for architecture: $Arch"
yarn build --arch=$Arch
} else {
Write-Output "Building for host architecture"
yarn build
}

if ($LASTEXITCODE -ne 0) {
Write-Error "Yarn build failed with exit code $LASTEXITCODE"
Expand Down
45 changes: 45 additions & 0 deletions docs/DEVELOPMENT_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,3 +303,48 @@ If you want to re-run the tests without re-building:
```bash
yarn test:nobuild
```

## Automated Desktop Releases

Desktop release artifacts are built automatically when a version tag is pushed.

### Trigger

Push a tag in semver format prefixed with `v`:

```bash
git tag v0.2.8-alpha.1
git push origin v0.2.8-alpha.1
```

The workflow creates or updates a draft GitHub Release and uploads installers.

### Restrict Who Can Release

The workflow enforces two checks before building:

- `RELEASE_ALLOWED_OWNER` must match the repository owner.
- `RELEASE_ALLOWED_ACTOR` must match the GitHub username that pushed the tag.

### Produced Artifacts

- Windows x64: `FGCS-Windows-<version>-Setup.exe`
- macOS x64: `FGCS-Mac-<version>-Installer-x64.dmg`
- macOS arm64: `FGCS-Mac-<version>-Installer-arm64.dmg`

### Publishing

Releases are uploaded as drafts. After validating artifacts, publish the draft release in GitHub.

### Rollback

If a tagged release fails:

1. Delete the tag locally and remotely.
2. Fix the issue.
3. Recreate and push the tag.

```bash
git tag -d v0.2.8-alpha.1
git push origin :refs/tags/v0.2.8-alpha.1
```
32 changes: 14 additions & 18 deletions gcs/electron-builder.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,39 @@
* @see https://www.electron.build/configuration/configuration
*/
{
$schema: 'https://raw.githubusercontent.com/electron-userland/electron-builder/master/packages/app-builder-lib/scheme.json',
appId: 'FGCS',
$schema: "https://raw.githubusercontent.com/electron-userland/electron-builder/master/packages/app-builder-lib/scheme.json",
appId: "FGCS",
asar: true,
productName: 'FGCS',
productName: "FGCS",
directories: {
output: 'release/${version}',
output: "release/${version}",
},
files: ['dist', 'dist-electron'],
files: ["dist", "dist-electron"],
mac: {
target: ['dmg'],
artifactName: '${productName}-Mac-${version}-Installer.${ext}',
icon: 'build/app_icon.icns'
target: ["dmg"],
artifactName: "${productName}-Mac-${version}-Installer-${arch}.${ext}",
icon: "build/app_icon.icns",
},
win: {
target: [
{
target: 'nsis',
arch: ['x64'],
target: "nsis",
arch: ["x64"],
},
],
artifactName: '${productName}-Windows-${version}-Setup.${ext}',
artifactName: "${productName}-Windows-${version}-Setup.${ext}",
},
nsis: {
oneClick: false,
perMachine: false,
allowToChangeInstallationDirectory: true,
deleteAppDataOnUninstall: false,
},
linux: {
target: ['AppImage'],
artifactName: '${productName}-Linux-${version}.${ext}',
},
extraFiles: [
{
from: 'extras',
to: 'extras',
filter: ['**/*'],
from: "extras",
to: "extras",
filter: ["**/*"],
},
],
}
4 changes: 2 additions & 2 deletions gcs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"version": "0.2.7-alpha",
"license": "GPL-3.0-only",
"homepage": "https://fgcs.projectfalcon.uk",
"githubLink": "https://github.com/Avis-Drone-Labs/FGCS",
"githubLink": "https://github.com/1Blademaster/FGCS",
"bugs": {
"url": "https://github.com/Avis-Drone-Labs/FGCS/issues/new/choose"
"url": "https://github.com/1Blademaster/FGCS/issues/new/choose"
},
"scripts": {
"test": "tsc && vite build && xvfb-maybe yarn playwright test",
Expand Down
Loading