From 4712a237120e664a3e2c38d48cff7a38f146f58a Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 21 Jul 2023 19:32:27 +0200 Subject: [PATCH] Add support for automatic nightly versions --- .github/workflows/ci.yml | 7 +++++++ .github/workflows/pr.yml | 7 +++++++ src/main.cpp | 6 +++++- src/version.h | 2 ++ 4 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 ff5b8b2..af54f45 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 < ./src/version.h + #pragma once + #define PLUGIN_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 86d0b0b..743518d 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -15,6 +15,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 < ./src/version.h + #pragma once + #define PLUGIN_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 8c40a7f..6156590 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,8 +1,12 @@ +#include "version.h" #include +#define PLUGIN_VERSION "v0.2.1" +#define PLUGIN_VERSION_FULL PLUGIN_VERSION PLUGIN_VERSION_EXTRA + WUPS_PLUGIN_NAME("drc_region_free_plugin"); WUPS_PLUGIN_DESCRIPTION("Allows the usage of gamepads from every region"); -WUPS_PLUGIN_VERSION("0.2.1"); +WUPS_PLUGIN_VERSION(PLUGIN_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..bfea8ae --- /dev/null +++ b/src/version.h @@ -0,0 +1,2 @@ +#pragma once +#define PLUGIN_VERSION_EXTRA "" \ No newline at end of file