-
-
Notifications
You must be signed in to change notification settings - Fork 133
Version Management for release 0.5 and Beyond #2098
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
base: develop
Are you sure you want to change the base?
Changes from all commits
c3d7f57
9613ff5
9699d86
000160d
9178a76
a918fd9
156b4ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| name: Release Build | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| env: | ||
| SOLUTION_FILE_PATH: . | ||
| BUILD_CONFIGURATION: Release | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: windows-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Determine Build Type and Version Info | ||
| id: info | ||
| shell: pwsh | ||
| run: | | ||
| $tag = "${{ github.ref_name }}" | ||
| $version = $tag.TrimStart('v') | ||
| $isPrerelease = "${{ github.event.release.prerelease }}" | ||
| if ($isPrerelease -eq "true") { | ||
| $buildType = "PRERELEASE" | ||
| $releaseName = "Phobos $tag (Pre-release)" | ||
| } else { | ||
| $buildType = "RELEASE" | ||
| $releaseName = "Phobos $tag" | ||
| } | ||
| echo "build-type=$buildType" >> $env:GITHUB_OUTPUT | ||
| echo "version=$version" >> $env:GITHUB_OUTPUT | ||
| echo "release-name=$releaseName" >> $env:GITHUB_OUTPUT | ||
|
|
||
| - name: Build Phobos | ||
| uses: ./.github/actions/build-phobos | ||
| with: | ||
| sln-path: ${{env.SOLUTION_FILE_PATH}} | ||
| build-config: ${{ env.BUILD_CONFIGURATION }} | ||
| build-type: ${{ steps.info.outputs.build-type }} | ||
|
|
||
| - name: Extract Changelog | ||
| shell: pwsh | ||
| run: | | ||
| .\scripts\extract_changelog.ps1 ` | ||
| -Tag "${{ github.ref_name }}" ` | ||
| -WhatsNewPath docs\Whats-New.md ` | ||
| -OutputPath RELEASE_NOTES.md | ||
|
|
||
| - name: Upload Release Assets | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| name: ${{ steps.info.outputs.release-name }} | ||
| files: | | ||
| ${{ env.BUILD_CONFIGURATION }}/Phobos.dll | ||
| ${{ env.BUILD_CONFIGURATION }}/Phobos.pdb | ||
| body_path: RELEASE_NOTES.md |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| param( | ||
| [Parameter(Mandatory = $true)] | ||
| [string]$Tag, | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| [string]$WhatsNewPath, | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| [string]$OutputPath | ||
| ) | ||
|
|
||
| $version = $Tag.TrimStart('v') | ||
|
|
||
| if (-not (Test-Path $WhatsNewPath)) { | ||
| Write-Error "File not found: $WhatsNewPath" | ||
| exit 1 | ||
| } | ||
|
|
||
| $content = (Get-Content -Path $WhatsNewPath -Raw -Encoding utf8) -replace "`r`n", "`n" | ||
|
|
||
| $changelogIdx = $content.IndexOf("## Changelog") | ||
| if ($changelogIdx -lt 0) { | ||
| Write-Error "Could not find '## Changelog' section in $WhatsNewPath" | ||
| exit 1 | ||
| } | ||
|
|
||
| $afterChangelog = $content.Substring($changelogIdx + "## Changelog".Length + 1) | ||
|
|
||
| $nextSectionIdx = $afterChangelog.IndexOf("`n## ") | ||
| $changelogBody = if ($nextSectionIdx -ge 0) { $afterChangelog.Substring(0, $nextSectionIdx) } else { $afterChangelog } | ||
|
|
||
| # Try to find the section: exact version -> parent versions -> Version TBD | ||
| $sectionStart = -1 | ||
|
|
||
| # 1) Exact version match | ||
| $sectionStart = $changelogBody.IndexOf("### $version`n") | ||
|
|
||
| # 2) Strip trailing numeric components until found | ||
| if ($sectionStart -lt 0) { | ||
| $tryVersion = $version -replace '\.[0-9]+$', '' | ||
| while ($tryVersion -ne $version) { | ||
| $sectionStart = $changelogBody.IndexOf("### $tryVersion`n") | ||
| if ($sectionStart -ge 0) { break } | ||
| $version = $tryVersion | ||
| $tryVersion = $version -replace '\.[0-9]+$', '' | ||
| } | ||
| $version = $Tag.TrimStart('v') # restore original | ||
| } | ||
|
|
||
| # 3) Fall back to Version TBD | ||
| if ($sectionStart -lt 0) { | ||
| $sectionStart = $changelogBody.IndexOf("### Version TBD") | ||
| } | ||
|
|
||
| if ($sectionStart -lt 0) { | ||
| Write-Error "Could not find changelog section for version '$version' or 'Version TBD'" | ||
| exit 1 | ||
| } | ||
|
|
||
| $sectionEnd = $changelogBody.IndexOf("`n### ", $sectionStart + 5) | ||
| if ($sectionEnd -ge 0) { | ||
| $sectionContent = $changelogBody.Substring($sectionStart, $sectionEnd - $sectionStart) | ||
| } else { | ||
| $sectionContent = $changelogBody.Substring($sectionStart) | ||
| } | ||
|
|
||
| $firstNewline = $sectionContent.IndexOf("`n") | ||
| if ($firstNewline -ge 0) { | ||
| $sectionContent = $sectionContent.Substring($firstNewline + 1) | ||
| } else { | ||
| $sectionContent = "" | ||
| } | ||
|
|
||
| $sectionContent = $sectionContent.Trim() | ||
|
|
||
| $dropdownPattern = '(?ms)^```\{dropdown\}[^\n]*\n(.+?)^```' | ||
| $dropdownMatch = [regex]::Match($sectionContent, $dropdownPattern) | ||
|
|
||
| if ($dropdownMatch.Success) { | ||
| $sectionContent = $dropdownMatch.Groups[1].Value.Trim() | ||
| } | ||
|
|
||
| $sectionContent = $sectionContent -replace '(?m)^:open:\s*\n', '' | ||
| $sectionContent = $sectionContent.Trim() | ||
|
|
||
| if (-not $sectionContent) { | ||
| Write-Error "Extracted changelog content is empty for version '$version'" | ||
| exit 1 | ||
| } | ||
|
|
||
| $sectionContent | Out-File -FilePath $OutputPath -Encoding utf8 | ||
|
|
||
| Write-Host "Extracted changelog for version '$version' to '$OutputPath'" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ | |
| #include "Utilities/AresHelper.h" | ||
| #include "Utilities/Parser.h" | ||
|
|
||
| #ifndef IS_RELEASE_VER | ||
| #ifndef RELEASE | ||
| bool HideWarning = false; | ||
| #endif | ||
|
|
||
|
|
@@ -31,7 +31,7 @@ bool Phobos::Optimizations::DisableSyncLogging = false; | |
|
|
||
| #ifdef STR_GIT_COMMIT | ||
| const wchar_t* Phobos::VersionDescription = L"Phobos nightly build (" STR_GIT_COMMIT L" @ " STR_GIT_BRANCH L"). DO NOT SHIP IN MODS!"; | ||
| #elif !defined(IS_RELEASE_VER) | ||
| #elif !defined(RELEASE) | ||
| const wchar_t* Phobos::VersionDescription = L"Phobos development build #" _STR(BUILD_NUMBER) L". Please test the build before shipping."; | ||
| #else | ||
| //const wchar_t* Phobos::VersionDescription = L"Phobos release build v" FILE_VERSION_STR L"."; | ||
|
|
@@ -60,7 +60,7 @@ void Phobos::CmdLineParse(char** ppArgs, int nNumArgs) | |
| { | ||
| Phobos::AppIconPath = ppArgs[++i]; | ||
| } | ||
| #ifndef IS_RELEASE_VER | ||
| #ifndef RELEASE | ||
| if (_stricmp(pArg, "-b=" _STR(BUILD_NUMBER)) == 0) | ||
| { | ||
| HideWarning = true; | ||
|
Comment on lines
64
to
66
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. opinion on instead asking the user to write a full version?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think full precise version name should be used, and yeah I agree arg name should probably be changed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. -IKnowWhatImDoing
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That sounds like a Boolean value needs to be filled in instead of a version number string :P |
||
|
|
@@ -233,7 +233,7 @@ DEFINE_HOOK(0x683E7F, ScenarioClass_Start_Optimizations, 0x7) | |
| return 0; | ||
| } | ||
|
|
||
| #ifndef IS_RELEASE_VER | ||
| #ifndef RELEASE | ||
| DEFINE_HOOK(0x4F4583, GScreenClass_DrawText, 0x6) | ||
| { | ||
| #ifndef STR_GIT_COMMIT | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,32 +22,32 @@ | |
|
|
||
| #pragma endregion | ||
|
|
||
| // Build number. Incremented on each released build. | ||
| #define BUILD_NUMBER 48 | ||
| // Pre-release build number. Incremented on each pre-release build. | ||
| #define PRERELEASE_NUM 1 | ||
|
Comment on lines
+25
to
+26
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you think this would be better than, say, a string
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why bother with such naming issues?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the issue is not in the naming but in limiting ourselves if we decide that we need a different name
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Kerbiter hopes to subdivide the pre-release phase into more smaller stages, so he designed things like
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think this is a somewhat unclear expression. Do you mean the value type of
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah. in this case it's just "maybe let's have more flexibility in case we need it in future"
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I mean with the current PR approach we can only have betas. what if we think we need something more in future? or if we decide we need another pre-release instead of beta? |
||
|
|
||
| // Nightly defines GIT_COMMIT and GIT_BRANCH in GH Actions | ||
| // NIGHTLY / PRERELEASE / RELEASE come from compiler option BuildType - used by GH Actions as well | ||
|
|
||
| #ifdef IS_RELEASE_VER // Release build metadata | ||
| #define SAVEGAME_ID ((VERSION_MAJOR << 24) | (VERSION_MINOR << 16) | (VERSION_REVISION << 8) | VERSION_PATCH) | ||
| #define FILE_DESCRIPTION "Phobos, Ares-compatible YR engine extension" | ||
| #define FILE_VERSION_STR _STR(VERSION_MAJOR) "." _STR(VERSION_MINOR) "." _STR(VERSION_REVISION) "." _STR(VERSION_PATCH) | ||
| #define FILE_VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_PATCH | ||
| #define PRODUCT_VERSION "Release Build " FILE_VERSION_STR | ||
| #elif defined(GIT_COMMIT) // Nightly devbuild metadata | ||
| #if defined(NIGHTLY) | ||
| #define STR_GIT_COMMIT _STR(GIT_COMMIT) | ||
| #define STR_GIT_BRANCH _STR(GIT_BRANCH) | ||
|
|
||
| #define SAVEGAME_ID ((BUILD_NUMBER << 24) | (BUILD_NUMBER << 12) | (BUILD_NUMBER)) | ||
| #define FILE_DESCRIPTION "Unstable nightly devbuild of Phobos engine extension" | ||
| #define SAVEGAME_ID ((VERSION_MAJOR << 24) | (VERSION_MINOR << 16) | (VERSION_REVISION << 8) | VERSION_PATCH) | ||
| #define FILE_DESCRIPTION "Unstable nightly build of Phobos engine extension" | ||
| #define FILE_VERSION_STR "Commit " STR_GIT_COMMIT | ||
| #define FILE_VERSION 0 | ||
| #define PRODUCT_VERSION "Nightly Build " STR_GIT_COMMIT " @ " STR_GIT_BRANCH | ||
| #else // Regular devbuild metadata | ||
| #define SAVEGAME_ID ((BUILD_NUMBER << 24) | (BUILD_NUMBER << 12) | (BUILD_NUMBER)) | ||
| #define FILE_DESCRIPTION "Development build of Phobos engine extension" | ||
| #define FILE_VERSION_STR "Build #" _STR(BUILD_NUMBER) | ||
| #define FILE_VERSION 0,0,0,BUILD_NUMBER | ||
| #define PRODUCT_VERSION "Development Build #" _STR(BUILD_NUMBER) | ||
| #elif defined(PRERELEASE) | ||
| #define SAVEGAME_ID ((VERSION_MAJOR << 24) | (VERSION_MINOR << 16) | (PRERELEASE_NUM << 8)) | ||
| #define FILE_DESCRIPTION "Pre-release build of Phobos, Ares-compatible YR engine extension" | ||
| #define FILE_VERSION_STR _STR(VERSION_MAJOR) "." _STR(VERSION_MINOR) "-beta" _STR(PRERELEASE_NUM) | ||
| #define FILE_VERSION VERSION_MAJOR, VERSION_MINOR, 0, 0 | ||
| #define PRODUCT_VERSION "v." _STR(VERSION_MAJOR) "." _STR(VERSION_MINOR) "-beta" _STR(PRERELEASE_NUM) | ||
| #else | ||
| #define SAVEGAME_ID ((VERSION_MAJOR << 24) | (VERSION_MINOR << 16) | (VERSION_REVISION << 8) | VERSION_PATCH) | ||
| #define FILE_DESCRIPTION "Phobos, Ares-compatible YR engine extension" | ||
| #define FILE_VERSION_STR _STR(VERSION_MAJOR) "." _STR(VERSION_MINOR) "." _STR(VERSION_REVISION) "." _STR(VERSION_PATCH) | ||
| #define FILE_VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_PATCH | ||
| #define PRODUCT_VERSION "v." FILE_VERSION_STR | ||
|
Comment on lines
+34
to
+50
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO for myself: look bit more carefully into this |
||
| #endif | ||
|
|
||
| #endif // VERSION_H | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably requires wording change