Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 4th digit in version number for CI build number #541

Merged
merged 7 commits into from
Oct 16, 2023
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
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on: [push, pull_request]

env:
BUILD_PROFILE: Release
NORTHSTAR_VERSION: 0.0.0.${{github.run_number}}

jobs:
build:
Expand All @@ -16,6 +17,13 @@ jobs:
uses: ilammy/msvc-dev-cmd@v1
- name: Configure cmake
run: cmake -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="${{ env.BUILD_PROFILE }}"
- name: Setup resource file version
shell: bash
run: |
sed -i 's/DEV/${{ env.NORTHSTAR_VERSION }}/g' NorthstarLauncher/resources.rc
sed -i 's/DEV/${{ env.NORTHSTAR_VERSION }}/g' NorthstarDLL/resources.rc
FILEVERSION=$(echo ${{ env.NORTHSTAR_VERSION }} | tr '.' ',' | sed -E 's/-rc[0-9]+//' | tr -d '[:alpha:]')
sed -i "s/0,0,0,1/${FILEVERSION}/g" NorthstarDLL/ns_version.h
- name: Build
run: cmake --build .
- name: Extract Short Commit Hash
Expand Down
6 changes: 3 additions & 3 deletions NorthstarDLL/util/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ void InitialiseVersion()
int ua_len = 0;

// We actually use the rightmost integer do determine whether or not we're a debug/dev build
// If it is set to 1, we are a dev build
// On github CI, we set this 1 to a 0 automatically as we replace the 0,0,0,1 with the real version number
if (northstar_version[3] == 1)
// If it is set to a non-zero value, we are a dev build
// On github CI, we set this to a 0 automatically as we replace the 0,0,0,1 with the real version number
if (northstar_version[3])
{
sprintf(version, "%d.%d.%d.%d+dev", northstar_version[0], northstar_version[1], northstar_version[2], northstar_version[3]);
ua_len += snprintf(
Expand Down