Skip to content

Commit 35b6552

Browse files
Add current version print to build scripts (#845)
* Add current version print to build scripts * Address copilot review comment * Make build.sh executable --------- Co-authored-by: Kwashie A <104215256+Kwash67@users.noreply.github.com>
1 parent 65478f0 commit 35b6552

2 files changed

Lines changed: 66 additions & 10 deletions

File tree

building/macos/build.sh

100644100755
Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,44 @@
22
set -euo pipefail
33

44
# Build FGCS for macOS (arm64 by default). Run from any directory.
5-
# Usage: ./build.sh <version>
5+
# Usage: ./build.sh [version]
6+
# If no version is provided, the script will show current version and prompt for new one
67

7-
if [[ ${1:-} == "" ]]; then
8-
echo "Usage: $0 <version>"
9-
echo "Example: $0 0.2.0-alpha"
10-
exit 1
11-
fi
12-
13-
VERSION="$1"
8+
VERSION="${1:-}"
149

1510
echo "Assuming location is FGCS/building/macos"
1611
cd ../../
1712

13+
# Read and display current version from package.json
14+
echo "Reading current version from package.json..."
15+
PACKAGE_JSON_PATH="./gcs/package.json"
16+
if [[ -f "$PACKAGE_JSON_PATH" ]]; then
17+
CURRENT_VERSION=$(grep '"version"' "$PACKAGE_JSON_PATH" | sed 's/.*"version": *"\([^"]*\)".*/\1/')
18+
echo "Current version: $CURRENT_VERSION"
19+
20+
# Prompt for version if not provided
21+
if [[ -z "$VERSION" ]]; then
22+
read -p "Enter new version number: " VERSION
23+
if [[ -z "$VERSION" ]]; then
24+
echo "Error: Version is required to continue"
25+
exit 1
26+
fi
27+
fi
28+
29+
echo "New version will be: $VERSION"
30+
else
31+
echo "Warning: Could not find package.json at $PACKAGE_JSON_PATH"
32+
33+
# Still prompt for version if package.json not found
34+
if [[ -z "$VERSION" ]]; then
35+
read -p "Enter version number: " VERSION
36+
if [[ -z "$VERSION" ]]; then
37+
echo "Error: Version is required to continue"
38+
exit 1
39+
fi
40+
fi
41+
fi
42+
1843
echo "Building backend"
1944
cd radio
2045
source ./venv/bin/activate

building/windows/build.ps1

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,48 @@
44
55
.EXAMPLE
66
.\build.ps1 -Version "0.1.8-alpha"
7+
.\build.ps1
78
#>
89

910
Param (
10-
[Parameter(Mandatory = $true)]
11+
[Parameter(Mandatory = $false)]
1112
[string]$Version
1213
)
1314

14-
Write-Output "Building backend"
1515
Write-Output "Assuming location is FGCS\building\windows"
1616
Set-Location ../../
1717

18+
# Read and display current version from package.json
19+
Write-Output "Reading current version from package.json..."
20+
$packageJsonPath = ".\gcs\package.json"
21+
if (Test-Path $packageJsonPath) {
22+
$packageJson = Get-Content $packageJsonPath | ConvertFrom-Json
23+
$currentVersion = $packageJson.version
24+
Write-Output "Current version: $currentVersion"
25+
26+
# Prompt for version if not provided
27+
if (-not $Version) {
28+
$Version = Read-Host "Enter new version number"
29+
if (-not $Version) {
30+
Write-Error "Version is required to continue"
31+
exit 1
32+
}
33+
}
34+
35+
Write-Output "New version will be: $Version"
36+
} else {
37+
Write-Warning "Could not find package.json at $packageJsonPath"
38+
39+
# Still prompt for version if package.json not found
40+
if (-not $Version) {
41+
$Version = Read-Host "Enter version number"
42+
if (-not $Version) {
43+
Write-Error "Version is required to continue"
44+
exit 1
45+
}
46+
}
47+
}
48+
1849
Write-Output "Building backend"
1950
Set-Location radio
2051
pip install pyinstaller

0 commit comments

Comments
 (0)