diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f2c663a..33e0e1d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,13 @@ jobs: needs: clang-format steps: - uses: actions/checkout@v3 + - name: create version.h + run: | + git_hash=$(git rev-parse --short "$GITHUB_SHA") + cat < ./source/version.h + #pragma once + #define ENVIRONMENT_LOADER_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 eb451d3..dfd634e 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -26,6 +26,13 @@ jobs: needs: clang-format steps: - uses: actions/checkout@v3 + - name: create version.h + run: | + git_hash=$(git rev-parse --short "${{ github.event.pull_request.head.sha }}") + cat < ./source/version.h + #pragma once + #define ENVIRONMENT_LOADER_VERSION_EXTRA " (nightly-$git_hash)" + EOF - name: build binary run: | docker build . -t builder diff --git a/source/main.cpp b/source/main.cpp index 97b0073..1886f6e 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -32,6 +32,9 @@ #include "utils/DrawUtils.h" #include "utils/InputUtils.h" #include "utils/PairUtils.h" +#include "version.h" + +#define ENVIRONMENT_LOADER_VERSION "v0.1.2" // clang-format off #define MEMORY_REGION_START 0x00A00000 @@ -350,6 +353,8 @@ std::string EnvironmentSelectionScreen(const std::map DrawUtils::setFontSize(24); DrawUtils::print(16, 6 + 24, "Environment Loader"); DrawUtils::drawRectFilled(8, 8 + 24 + 4, SCREEN_WIDTH - 8 * 2, 3, COLOR_WHITE); + DrawUtils::setFontSize(16); + DrawUtils::print(SCREEN_WIDTH - 16, 6 + 24, ENVIRONMENT_LOADER_VERSION ENVIRONMENT_LOADER_VERSION_EXTRA, true); // draw bottom bar DrawUtils::drawRectFilled(8, SCREEN_HEIGHT - 24 - 8 - 4, SCREEN_WIDTH - 8 * 2, 3, COLOR_WHITE); diff --git a/source/version.h b/source/version.h new file mode 100644 index 0000000..c61ad51 --- /dev/null +++ b/source/version.h @@ -0,0 +1,2 @@ +#pragma once +#define ENVIRONMENT_LOADER_VERSION_EXTRA "" \ No newline at end of file