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
6 changes: 6 additions & 0 deletions .github/workflows/build-linux-flatpak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ jobs:
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true

- name: Populate Git Info for Sandboxed Build
run: |
echo "GENERALS_GIT_OVERRIDE_TSTAMP=$(git log -1 --format=%ct 2>/dev/null || echo '0')" >> $GITHUB_ENV
echo "GENERALS_GIT_OVERRIDE_TAG=$(git describe --tags --exact-match 2>/dev/null || echo '')" >> $GITHUB_ENV

- name: Install Build Dependencies
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true

- name: Cache vcpkg
id: cache-vcpkg
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true

- name: Cache brew packages
id: cache-brew
Expand Down
30 changes: 19 additions & 11 deletions Core/GameEngine/Source/Common/UpdateChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,20 +209,28 @@ static int SDLCALL threadFunc(void* /*userData*/)
}
else
{
const bool hasCommitTimestamp = GitCommitTimeStamp > 0;
char publishedAt[64] = {0};
if (hasCommitTimestamp && extractPublishedAt(responseBody, publishedAt, sizeof(publishedAt)))
// First check if the tag matches exactly. If it does, we are definitely on the latest version.
if (GitTag[0] != '\0' && strcmp(latestTag, GitTag) == 0)
{
time_t remoteTime = parseISO8601(publishedAt);
// Signal update only when the remote release was published strictly
// AFTER the commit this binary was built from.
if (remoteTime != (time_t)-1 && remoteTime > GitCommitTimeStamp)
hasUpdate = true;
hasUpdate = false;
}
else if (GitTag[0] != '\0')
else
{
// No usable published_at comparison; fall back to tag string comparison.
hasUpdate = (strcmp(latestTag, GitTag) != 0);
const bool hasCommitTimestamp = GitCommitTimeStamp > 0;
char publishedAt[64] = {0};
if (hasCommitTimestamp && extractPublishedAt(responseBody, publishedAt, sizeof(publishedAt)))
{
time_t remoteTime = parseISO8601(publishedAt);
// Signal update only when the remote release was published strictly
// AFTER the commit this binary was built from.
if (remoteTime != (time_t)-1 && remoteTime > GitCommitTimeStamp)
hasUpdate = true;
}
else if (GitTag[0] != '\0')
{
// No usable published_at comparison; fall back to tag string comparison.
hasUpdate = (strcmp(latestTag, GitTag) != 0);
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions docs/WORKLOG/2026-07-DIARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ Both issues have been resolved by adding proper counting filters in MiniAudio an
- Preserved bone positioning logic in `SlavedUpdate.cpp` and fixed pointer dereferencing for `Coord3D` operations (`*obj->getPosition()`).
- Accepted the upstream re-organization of GameClient UI code and removed deprecated ControlBar files.
- Ensured deterministic math usage and successfully built the macOS target (`macos-vulkan`).
## 13/07/2026
### Update Checker Fixes for GitHub Actions
- Fixed `UpdateChecker` not showing up in GitHub Actions deployments due to missing Git metadata in Flatpak builds and `actions/checkout` not fetching tags.
- Fixed a logic bug where a newly compiled release would immediately flag itself as outdated.
27 changes: 27 additions & 0 deletions resources/gitinfo/git_watcher.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,33 @@ function(GetGitState _working_dir)
# RunGitCommand ever returns a non-zero exit code.
set(ENV{GIT_RETRIEVED_STATE} "true")

# Allow passing override variables from CI or sandboxed environments via file
include("${_working_dir}/.git-override.cmake" OPTIONAL)

if(DEFINED GENERALS_GIT_OVERRIDE_TSTAMP OR DEFINED GENERALS_GIT_OVERRIDE_TAG)
set(ENV{GIT_IS_DIRTY} "false")
if(DEFINED GENERALS_GIT_OVERRIDE_IS_DIRTY)
set(ENV{GIT_IS_DIRTY} "${GENERALS_GIT_OVERRIDE_IS_DIRTY}")
endif()
set(ENV{GIT_HEAD_SHA1} "0000000000000000000000000000000000000000")
set(ENV{GIT_AUTHOR_NAME} "GitHub Actions")
set(ENV{GIT_AUTHOR_EMAIL} "actions@github.com")
set(ENV{GIT_COMMIT_DATE_ISO8601} "")
set(ENV{GIT_COMMIT_SUBJECT} "Override")
set(ENV{GIT_COMMIT_BODY} "\"\"")
set(ENV{GIT_COMMIT_TSTAMP} "0")
if(DEFINED GENERALS_GIT_OVERRIDE_TSTAMP)
set(ENV{GIT_COMMIT_TSTAMP} "${GENERALS_GIT_OVERRIDE_TSTAMP}")
endif()
set(ENV{GIT_HEAD_SHORT_SHA1} "00000000")
set(ENV{GIT_REV_LIST_COUNT} "0")
set(ENV{GIT_TAG} "")
if(DEFINED GENERALS_GIT_OVERRIDE_TAG)
set(ENV{GIT_TAG} "${GENERALS_GIT_OVERRIDE_TAG}")
endif()
return()
endif()

if(GIT_EXECUTABLE)
# Get whether or not the working tree is dirty.
RunGitCommand(status --porcelain)
Expand Down
9 changes: 9 additions & 0 deletions scripts/build/linux/build-linux-flatpak.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ BUILDER_ARGS=(
--install-deps-from=flathub
)

if [[ -n "${GENERALS_GIT_OVERRIDE_TAG:-}" ]] || [[ -n "${GENERALS_GIT_OVERRIDE_TSTAMP:-}" ]]; then
cat > "${PROJECT_ROOT}/.git-override.cmake" <<EOF
set(GENERALS_GIT_OVERRIDE_TAG "${GENERALS_GIT_OVERRIDE_TAG:-}")
set(GENERALS_GIT_OVERRIDE_TSTAMP "${GENERALS_GIT_OVERRIDE_TSTAMP:-0}")
EOF
else
rm -f "${PROJECT_ROOT}/.git-override.cmake"
fi

if [[ "${GENERALSX_FLATPAK_USE_CCACHE}" == "1" ]]; then
BUILDER_ARGS+=(--ccache)
echo "[$(ts)] flatpak-builder ccache enabled (GENERALSX_FLATPAK_USE_CCACHE=1)."
Expand Down
Loading