From 134f7d6e544c46b753986ee425bc88edf07347b7 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 24 Oct 2021 00:10:47 +1000 Subject: [PATCH] CI: Set version in rc files at build time --- .github/workflows/rolling-release.yml | 17 +++++++++++++++++ src/scmversion/update_rc_version.bat | 9 +++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/scmversion/update_rc_version.bat diff --git a/.github/workflows/rolling-release.yml b/.github/workflows/rolling-release.yml index d767526ac..33f46deda 100644 --- a/.github/workflows/rolling-release.yml +++ b/.github/workflows/rolling-release.yml @@ -46,6 +46,15 @@ jobs: echo #define SCM_RELEASE_TAGS {"latest", "preview"} >> src/scmversion/tag.h echo #define SCM_RELEASE_TAG "latest" >> src/scmversion/tag.h + - name: Update RC version fields + shell: cmd + run: | + cd src\scmversion + call update_rc_version.bat + cd ..\.. + git update-index --assume-unchanged src/duckstation-qt/duckstation-qt.rc + git update-index --assume-unchanged src/duckstation-nogui/duckstation-nogui.rc + - name: Compile x64 release build shell: cmd run: | @@ -108,6 +117,14 @@ jobs: echo #define SCM_RELEASE_TAGS {"latest", "preview"} >> src/scmversion/tag.h echo #define SCM_RELEASE_TAG "latest" >> src/scmversion/tag.h + - name: Update RC version fields + shell: cmd + run: | + cd src\scmversion + call update_rc_version.bat + cd ..\.. + git update-index --assume-unchanged src/duckstation-qt/duckstation-qt.rc + git update-index --assume-unchanged src/duckstation-nogui/duckstation-nogui.rc - name: Compile arm64 release build shell: cmd diff --git a/src/scmversion/update_rc_version.bat b/src/scmversion/update_rc_version.bat new file mode 100644 index 000000000..76aa528eb --- /dev/null +++ b/src/scmversion/update_rc_version.bat @@ -0,0 +1,9 @@ +@echo off + +FOR /F "tokens=* USEBACKQ" %%g IN (`git describe --tags --dirty --exclude latest --exclude preview --exclude play-store-release`) do (SET "TAG=%%g") + +powershell -Command "(gc ..\duckstation-qt\duckstation-qt.rc) -replace '1,0,0,1', '"%TAG:~0,1%","%TAG:~2,1%","%TAG:~4,4%",0' | Out-File -encoding ASCII ..\duckstation-qt\duckstation-qt.rc" +powershell -Command "(gc ..\duckstation-qt\duckstation-qt.rc) -replace '1.0.0.1', '"%TAG:~0,1%"."%TAG:~2,1%"."%TAG:~4,4%"' | Out-File -encoding ASCII ..\duckstation-qt\duckstation-qt.rc" + +powershell -Command "(gc ..\duckstation-nogui\duckstation-nogui.rc) -replace '1,0,0,1', '"%TAG:~0,1%","%TAG:~2,1%","%TAG:~4,4%",0' | Out-File -encoding ASCII ..\duckstation-nogui\duckstation-nogui.rc +powershell -Command "(gc ..\duckstation-nogui\duckstation-nogui.rc) -replace '1.0.0.1', '"%TAG:~0,1%"."%TAG:~2,1%"."%TAG:~4,4%"' | Out-File -encoding ASCII ..\duckstation-nogui\duckstation-nogui.rc" \ No newline at end of file