From 3dfa9ffca0d5aff3a62a2d9908a88067eee0647c Mon Sep 17 00:00:00 2001 From: Maschell Date: Mon, 19 Sep 2022 15:14:46 +0200 Subject: [PATCH] Add the git-hash to the version if using a nightly build --- .github/workflows/ci.yml | 7 +++++++ .github/workflows/pr.yml | 7 +++++++ src/globals.h | 4 ++++ src/main.cpp | 2 +- src/version.h | 2 ++ 5 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/version.h diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d81c3b8..b210e5c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,13 @@ jobs: needs: clang-format steps: - uses: actions/checkout@v2 + - name: create version.h + run: | + git_hash=$(git rev-parse --short "$GITHUB_SHA") + cat < ./src/version.h + #pragma once + #define VERSION_EXTRA " (nightly-$git_hash)" + EOF - name: build binary run: | docker build . -t builder diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 179d506..1417aa3 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -15,6 +15,13 @@ jobs: needs: clang-format steps: - uses: actions/checkout@v2 + - name: create version.h + run: | + git_hash=$(git rev-parse --short "${{ github.event.pull_request.head.sha }}") + cat < ./src/version.h + #pragma once + #define VERSION_EXTRA " (nightly-$git_hash)" + EOF - name: build binary run: | docker build . -t builder diff --git a/src/globals.h b/src/globals.h index 511cfd5..706a2d0 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1,7 +1,11 @@ #pragma once +#include "version.h" #include +#define VERSION "v0.1" +#define VERSION_FULL VERSION VERSION_EXTRA + extern int gForceSettingsEnabled; enum Lanuages { diff --git a/src/main.cpp b/src/main.cpp index 561e92c..1394a9c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,7 +16,7 @@ WUPS_PLUGIN_NAME("Region Free Plugin"); WUPS_PLUGIN_DESCRIPTION("Allows the user to load titles from other regions"); -WUPS_PLUGIN_VERSION("0.1"); +WUPS_PLUGIN_VERSION(VERSION_FULL); WUPS_PLUGIN_AUTHOR("Maschell"); WUPS_PLUGIN_LICENSE("GPL"); diff --git a/src/version.h b/src/version.h new file mode 100644 index 0000000..66a2c7e --- /dev/null +++ b/src/version.h @@ -0,0 +1,2 @@ +#pragma once +#define VERSION_EXTRA "" \ No newline at end of file