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
35 changes: 32 additions & 3 deletions .github/workflows/build-all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ on:
jobs:
common:
runs-on: ubuntu-latest
outputs:
SEMVER: ${{ steps.version_generator.outputs.SEMVER }}
PROJECTNAME: ${{ steps.version_generator.outputs.PROJECTNAME }}
GitVersion_Major: ${{ steps.version_generator.outputs.GitVersion_Major }}
GitVersion_Minor: ${{ steps.version_generator.outputs.GitVersion_Minor }}
GitVersion_Patch: ${{ steps.version_generator.outputs.GitVersion_Patch }}
GitVersion_VersionSourceDistance: ${{ steps.version_generator.outputs.GitVersion_VersionSourceDistance }}
steps:
- name: Checkout project
uses: actions/checkout@v6
Expand Down Expand Up @@ -34,8 +41,15 @@ jobs:
semantic-version-format=Loose
next-version=1.93.1

- name: Check environment
- name: Print and register result
id: version_generator
run: |
echo "SEMVER=$GitVersion_SemVer" >> "$GITHUB_OUTPUT"
echo "GitVersion_Major=$GitVersion_Major" >> "$GITHUB_OUTPUT"
echo "GitVersion_Minor=$GitVersion_Minor" >> "$GITHUB_OUTPUT"
echo "GitVersion_Patch=$GitVersion_Patch" >> "$GITHUB_OUTPUT"
echo "GitVersion_VersionSourceDistance=$GitVersion_VersionSourceDistance" >> "$GITHUB_OUTPUT"
echo "PROJECTNAME=$PROJECTNAME" >> "$GITHUB_OUTPUT"
printenv | sort

build-linux:
Expand Down Expand Up @@ -80,6 +94,9 @@ jobs:
run: |
oolite/ShellScripts/Linux/install_mozilla_js.sh system
- name: Build Oolite
env:
SEMVER: ${{ needs.common.outputs.SEMVER }}
PROJECTNAME: ${{ needs.common.outputs.PROJECTNAME }}
run: |
oolite/ShellScripts/common/build_oolite.sh ${{matrix.flavour}}
- name: Archive installer
Expand All @@ -103,6 +120,9 @@ jobs:
path: oolite
fetch-depth: 0
- name: Build flatpak
env:
SEMVER: ${{ needs.common.outputs.SEMVER }}
PROJECTNAME: ${{ needs.common.outputs.PROJECTNAME }}
run: |
oolite/installers/flatpak/create_flatpak.sh
- name: Archive installer
Expand Down Expand Up @@ -151,6 +171,13 @@ jobs:
shell: msys2 {0}
env:
msystem: UCRT64
VER_MAJ: ${{ needs.common.outputs.GitVersion_Major }}
VER_MIN: ${{ needs.common.outputs.GitVersion_Minor }}
VER_REV: ${{ needs.common.outputs.GitVersion_Patch }}
VER_GITREV: ${{ needs.common.outputs.GitVersion_VersionSourceDistance }}
SEMVER: ${{ needs.common.outputs.SEMVER }}
VER_NSIS: ${{ needs.common.outputs.GitVersion_Major }}.${{ needs.common.outputs.GitVersion_Minor }}.${{ needs.common.outputs.GitVersion_Patch }}.${{ needs.common.outputs.GitVersion_VersionSourceDistance }}
PROJECTNAME: ${{ needs.common.outputs.PROJECTNAME }}
run: |
oolite/ShellScripts/common/build_oolite.sh ${{matrix.flavour}}
- name: Archive installer
Expand All @@ -162,7 +189,7 @@ jobs:
retention-days: 5

release:
needs: [build-linux, build-flatpak, build-windows]
needs: [build-linux, build-flatpak, build-windows, common]
runs-on: ubuntu-22.04
steps:
## This is for debugging only and helps developing the workflow.
Expand All @@ -181,6 +208,9 @@ jobs:
fetch-depth: 0
- name: Calculate version number and set OOLITE_VERSION
id: version
env:
SEMVER: ${{ needs.common.outputs.SEMVER }}
PROJECTNAME: ${{ needs.common.outputs.PROJECTNAME }}
run: |
set -x
cd oolite
Expand All @@ -199,7 +229,6 @@ jobs:
# For changes on master branch, create a new release.
# It should move the 'latest' tag automatically.
- name: Create Release
if: github.ref == 'refs/heads/master' || endsWith(github.ref, 'maintenance')
id: create_release
uses: "marvinpinto/action-automatic-releases@latest"
with:
Expand Down
19 changes: 17 additions & 2 deletions ShellScripts/Linux/install_freedesktop_fn.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
#!/bin/bash
#!/bin/bash -x
#
# Installs the manifest and injects version number
#
# Requires environment variables:
# VERSION
# APP_DATE
#

echo "I am install_freedesktop_fn.sh $@"
printenv | sort

install_freedesktop() {
# Install metainfo (eg. for FlatHub and AppImageHub)
Expand Down Expand Up @@ -45,10 +55,15 @@ install_freedesktop() {
sed -i "s/@VER@/${VERSION}/g" "$APP_METAINFO"
sed -i "s/@DATE@/${APP_DATE}/g" "$APP_METAINFO"

echo ===========================================
echo Our manifest looks like this:
cat "$APP_METAINFO"
echo ===========================================

# Desktop and Icon
install -D ../../installers/FreeDesktop/space.oolite.Oolite.desktop "$APPSHR/applications/space.oolite.Oolite.desktop" || { echo "$err_msg desktop file" >&2; return 1; }

install -D "$PROGDIR/Resources/Textures/oolite-logo1.png" "$APPSHR/icons/hicolor/256x256/apps/space.oolite.Oolite.png" || { echo "$err_msg icon file" >&2; return 1; }

popd
}
}
42 changes: 28 additions & 14 deletions ShellScripts/common/get_version.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
#!/bin/bash
#
# Calculates the Oolite version number if not passed via env variables.
# Output goes into the OOLITE_VERSION.txt file and to stdout.
#

SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
pushd "$SCRIPT_DIR" > /dev/null

mkdir -p ../../build
cd ../../build

VERSION=$(cat ../src/Cocoa/oolite-version.xcconfig | cut -d '=' -f 2)
VER_MAJ=$(echo "$VERSION" | cut -d. -f1)
VER_MIN=$(echo "$VERSION" | cut -d. -f2)
VER_REV=$(echo "$VERSION" | cut -d. -f3)
if [ "" == "$VER_REV" ]; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single Brackets (Dangerous):
if [ $name == "Bob" ]
If $name is empty, Bash sees: if [ == "Bob" ], which is a syntax error.

Double Brackets (Safe):
if [[ $name == "Bob" ]]
Even if $name is empty, Bash handles it gracefully without requiring extra quotes.

I try to stick to double brackets everywhere for consistency.

VER_REV="0"
fi
# Timestamp of last commit/push
TIMESTAMP=$(git log -1 --format=%ct)

# Date conversions use UTC for consistency
# Convert to __DATE__ format (e.g., Feb 20 2026)
CPP_DATE=$(date -u -d "@$TIMESTAMP" +"%b %e %Y")
Expand All @@ -22,14 +21,29 @@ APP_DATE=$(date -u -d "@$TIMESTAMP" +"%Y-%m-%d")
# Convert to YYMMDD format (e.g., 260313)
VER_DATE=$(date -u -d "@$TIMESTAMP" +"%y%m%d")

VER_GITREV=$(git rev-list --count HEAD)
VER_GITHASH=$(git rev-parse --short=7 HEAD)
VER_FULL="$VER_MAJ.$VER_MIN.$VER_REV.$VER_GITREV-$VER_DATE-$VER_GITHASH"
BUILDTIME=$(date "+%Y.%m.%d %H:%M")

if [[ -z "${SEMVER}" ]] || [[ -z "${PROJECTNAME}" ]]
then
# Variables not passed in. Calculate the classic way.

VERSION=$(cat ../src/Cocoa/oolite-version.xcconfig | cut -d '=' -f 2)
VER_MAJ=$(echo "$VERSION" | cut -d. -f1)
VER_MIN=$(echo "$VERSION" | cut -d. -f2)
VER_REV=$(echo "$VERSION" | cut -d. -f3)
if [[ "" == "$VER_REV" ]]; then
VER_REV="0"
fi

VER_GITREV=$(git rev-list --count HEAD)
VER_GITHASH=$(git rev-parse --short=7 HEAD)
VER_FULL="$VER_MAJ.$VER_MIN.$VER_REV.$VER_GITREV-$VER_DATE-$VER_GITHASH"
BUILDTIME=$(date "+%Y.%m.%d %H:%M")
else
# Variables passed in. Make use of them.

VER_FULL="${SEMVER}"
Copy link
Copy Markdown
Contributor

@mcarans mcarans May 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplify to "$SEMVER"

fi

echo "OOLITE_VERSION=$VER_FULL" > OOLITE_VERSION.txt

echo "$VER_FULL"

popd > /dev/null
popd > /dev/null
8 changes: 7 additions & 1 deletion installers/appimage/create_appimage.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/bin/bash
#!/bin/bash -x
#
# Creates the appimage.
# First parameter can be set to build type, typically one of "test", "dev" or omitted for release builds.
#

echo I am $0 $@

run_script() {
# First parameter is a suffix for the build type eg. test, dev
Expand Down
17 changes: 16 additions & 1 deletion installers/flatpak/create_flatpak.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash
#!/bin/bash -x

echo "I am $0 $@"

run_script() {
# First parameter is a suffix for the build type eg. test, dev
Expand Down Expand Up @@ -31,8 +33,17 @@ run_script() {
fi

local MANIFEST="space.oolite.Oolite.yaml"

if [ -n "${SEMVER}" ] && [ -n "${PROJECTNAME}" ]; then
# patch manifest
sed -i "97a \ env:\n SEMVER: $SEMVER\n PROJECTNAME: $PROJECTNAME\n VERSION: $SEMVER" $MANIFEST || return 1
fi

# check manifest
if command -v flatpak-builder-lint >/dev/null 2>&1; then
if ! flatpak-builder-lint manifest "$MANIFEST"; then
echo "❌ Flatpak manifest lint failed!" >&2
cat $MANIFEST
echo "❌ Flatpak manifest lint failed!" >&2
return 1
fi
Expand Down Expand Up @@ -60,6 +71,10 @@ run_script() {
- type: dir
path: ../
EOF

# show effective manifest
flatpak-builder --show-manifest $MANIFEST

if ! flatpak-builder \
--user \
--force-clean \
Expand Down
8 changes: 7 additions & 1 deletion installers/flatpak/flatpak_build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/bin/bash
#!/bin/bash -x
#
# Prepares the app directory for the flatpak builder
#

echo "I am flatpak_build.sh $@"
printenv | sort

source /app/share/GNUstep/Makefiles/GNUstep.sh
source ShellScripts/common/get_version.sh
Expand Down
9 changes: 6 additions & 3 deletions installers/win32/OOlite.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
!ifndef OUTDIR
!define OUTDIR .
!endif
!ifndef SEMVER
!define SEMVER ${VERSION}
!endif

!ifndef SNAPSHOT
!ifndef DEPLOYMENT
Expand Down Expand Up @@ -58,10 +61,10 @@ SetCompress auto
SetCompressor LZMA
SetCompressorDictSize 32
SetDatablockOptimize on
OutFile "${OUTDIR}\OoliteInstall-${VER}-win${EXTVER}.exe"
OutFile "${OUTDIR}\OoliteInstall-${SEMVER}-win${EXTVER}.exe"
BrandingText "(C) 2003-2026 Giles Williams, Jens Ayton and contributors"
Name "Oolite"
Caption "Oolite ${VER}${EXTVER} Setup"
Caption "Oolite ${SEMVER} ${EXTVER} Setup"
SubCaption 0 " "
SubCaption 1 " "
SubCaption 2 " "
Expand All @@ -83,7 +86,7 @@ VIAddVersionKey "ProductName" "Oolite"
VIAddVersionKey "FileDescription" "A space combat/trading game, inspired by Elite."
VIAddVersionKey "LegalCopyright" "� 2003-2026 Giles Williams, Jens Ayton and contributors"
VIAddVersionKey "FileVersion" "${VER}"
VIAddVersionKey "ProductVersion" "${VER}"
VIAddVersionKey "ProductVersion" "${SEMVER}"
!ifdef SNAPSHOT
VIAddVersionKey "GIT Revision" "${VER_GITHASH}"
!endif
Expand Down
20 changes: 18 additions & 2 deletions installers/win32/create_nsis.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
#!/bin/bash
#!/bin/bash -x
#
# Creates the windows installer using NSIS.
# First parameter can be set to build type, typically one of "test", "dev" or omitted for release builds.
# Accepts two verion variables:
# VER_FULL - the full version number Oolite is getting built with
# VER_NSIS - the numberical version number (x.x.x.x) that the NSIS installer is built with
#

echo I am $0 $@


run_script() {
# First parameter is a suffix for the build type eg. test, dev
Expand Down Expand Up @@ -32,6 +42,11 @@ run_script() {
return 1
fi

if [[ -z "${VER_NSIS}" ]]
then
export VER_NSIS=$VER_FULL;
fi

# Passing arguments cause problems with some versions of NSIS.
# Because of this, we generate them into a separate file and include them.
echo "; Version Definitions for Oolite" > OoliteVersions.nsh
Expand All @@ -41,7 +56,8 @@ run_script() {
echo "!define VER_REV ${VER_REV}" >> OoliteVersions.nsh
echo "!define VER_GITREV ${VER_GITREV}" >> OoliteVersions.nsh
echo "!define VER_GITHASH ${VER_GITHASH}" >> OoliteVersions.nsh
echo "!define VERSION ${VER_FULL}" >> OoliteVersions.nsh
echo "!define VERSION ${VER_NSIS}" >> OoliteVersions.nsh
echo "!define SEMVER ${SEMVER}" >> OoliteVersions.nsh
echo "!define BUILDTIME \"${BUILDTIME}\"" >> OoliteVersions.nsh
echo "!define BUILDHOST_IS64BIT 1" >> OoliteVersions.nsh

Expand Down
Loading