From c40df1a909ee7b82c03be8602acecda1d0fcd836 Mon Sep 17 00:00:00 2001 From: Maschell Date: Mon, 19 Sep 2022 13:32:05 +0200 Subject: [PATCH] Update the version and add support using the git hash on nightlies --- .github/workflows/ci.yml | 7 +++++++ .github/workflows/pr.yml | 7 +++++++ src/main.cpp | 3 ++- src/main.h | 8 ++++++-- src/version.h | 2 ++ 5 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 src/version.h diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f564275..e4f1d8d 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 f52debf..3e13871 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -26,6 +26,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/main.cpp b/src/main.cpp index 49879eb..c0acc8b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,3 +1,4 @@ +#include "main.h" #include "BackgroundThread.hpp" #include "utils/logger.h" #include "virtualpath.h" @@ -9,7 +10,7 @@ WUPS_PLUGIN_NAME("FTPiiU"); WUPS_PLUGIN_DESCRIPTION("FTP Server"); -WUPS_PLUGIN_VERSION("0.1"); +WUPS_PLUGIN_VERSION(VERSION_FULL_RAW); WUPS_PLUGIN_AUTHOR("Maschell"); WUPS_PLUGIN_LICENSE("GPL"); diff --git a/src/main.h b/src/main.h index 949103b..cbad381 100644 --- a/src/main.h +++ b/src/main.h @@ -7,11 +7,15 @@ extern "C" { #endif #include "net.h" +#include "version.h" #include -#define MAXPATHLEN 256 +#define MAXPATHLEN 256 -#define wiiu_geterrno() (errno) +#define VERSION_RAW "0.1.1" +#define VERSION_FULL_RAW VERSION_RAW VERSION_EXTRA + +#define wiiu_geterrno() (errno) //! C wrapper for our C++ functions int Menu_Main(void); 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