mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add the git SHA to the build ID.
The build number is actually a pain to use. The git SHA is much more useful.
This commit is contained in:
parent
9ad92d26d4
commit
2ac9d6bd98
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
@ -25,6 +25,7 @@ jobs:
|
||||
- name: Set build number
|
||||
run: |
|
||||
[IO.File]::WriteAllLines($pwd.path + "\resources\buildnumber", $env:GITHUB_RUN_NUMBER)
|
||||
[IO.File]::WriteAllLines($pwd.path + "\resources\gitsha", $env:GITHUB_SHA)
|
||||
|
||||
- name: Build app
|
||||
uses: ./.github/actions/build-app
|
||||
|
||||
@ -6,15 +6,24 @@ MINOR_VERSION = 0
|
||||
MICRO_VERSION = 0
|
||||
|
||||
|
||||
def _optional_build_id_component(path: Path) -> str | None:
|
||||
if path.exists():
|
||||
return path.read_text().strip()
|
||||
return None
|
||||
|
||||
|
||||
BUILD_NUMBER = _optional_build_id_component(Path("resources/buildnumber"))
|
||||
GIT_SHA = _optional_build_id_component(Path("resources/gitsha"))
|
||||
|
||||
|
||||
def _build_version_string() -> str:
|
||||
components = [
|
||||
".".join(str(v) for v in (MAJOR_VERSION, MINOR_VERSION, MICRO_VERSION))
|
||||
]
|
||||
build_number_path = Path("resources/buildnumber")
|
||||
if build_number_path.exists():
|
||||
with build_number_path.open("r", encoding="utf-8") as build_number_file:
|
||||
components.append(build_number_file.readline())
|
||||
|
||||
if BUILD_NUMBER is not None:
|
||||
components.append(BUILD_NUMBER)
|
||||
if GIT_SHA is not None:
|
||||
components.append(GIT_SHA)
|
||||
if not Path("resources/final").exists():
|
||||
components.append("preview")
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user