diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 25c3749..94e1486 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,6 +21,14 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macos-latest] steps: + - name: Get version from input + id: tag_name + shell: bash + env: + INPUT_VERSION: ${{ github.event.inputs.version }} + run: | + echo ::set-output name=current_version::${INPUT_VERSION} + - uses: actions/checkout@v2 - uses: actions/cache@v2 with: @@ -32,7 +40,7 @@ jobs: working-directory: ${{github.workspace}} run: | cmake -E make_directory build/ - cmake -S . -B build/ -DCMAKE_BUILD_TYPE=$BUILD_TYPE + cmake -S . -B build/ -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DRPGMPACKER_VERSION=${{ steps.tag_name.outputs.current_version }} cmake --build build/ --config $BUILD_TYPE - name: Test (Windows) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4c444d..490a403 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ The format is based on [Keep a Changelog][Keep a Changelog] and this project adh ## [Released] +## [1.6.2] - 2021-04-07 + +### Added + +- Added `--version` argument for printing the program version ([#40](https://github.com/erri120/rpgmpacker/issues/40)) + ## [1.6.1] - 2021-04-05 ### Added @@ -135,8 +141,9 @@ This change does not change anything for the end-consumer of the tool but is a h [Semantic Versioning]: https://semver.org/ -[Unreleased]: https://github.com/erri120/rpgmpacker/compare/v1.6.1...HEAD +[Unreleased]: https://github.com/erri120/rpgmpacker/compare/v1.6.2...HEAD [Released]: https://github.com/erri120/rpgmpacker/releases/ +[1.6.1]: https://github.com/erri120/rpgmpacker/compare/v1.6.1...v1.6.2 [1.6.1]: https://github.com/erri120/rpgmpacker/compare/v1.6.0...v1.6.1 [1.6.0]: https://github.com/erri120/rpgmpacker/compare/v1.5.4...v1.6.0 [1.5.4]: https://github.com/erri120/rpgmpacker/compare/v1.5.3...v1.5.4 diff --git a/README.md b/README.md index 45f42a7..719eaba 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ Simple CLI program for packaging RPG Maker games to use in an automated build/de (default: 2) -d, --debug Enable debugging output (very noisy). (default: false) + -v, --version Print version -h, --help Print usage ``` diff --git a/RPGMPacker/CMakeLists.txt b/RPGMPacker/CMakeLists.txt index 7bef395..e7d7309 100644 --- a/RPGMPacker/CMakeLists.txt +++ b/RPGMPacker/CMakeLists.txt @@ -35,4 +35,8 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang") # GCC/Clang set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3") +endif() + +if(RPGMPACKER_VERSION) + add_compile_definitions(RPGMPACKER_VERSION="${RPGMPACKER_VERSION}") endif() \ No newline at end of file diff --git a/RPGMPacker/src/main.cpp b/RPGMPacker/src/main.cpp index 1c4a041..c28f9d5 100644 --- a/RPGMPacker/src/main.cpp +++ b/RPGMPacker/src/main.cpp @@ -20,6 +20,10 @@ #include #include +#ifndef RPGMPACKER_VERSION +#define RPGMPACKER_VERSION "1.0.0" +#endif + int main(int argc, char** argv) { std::error_code ec; auto logger = spdlog::stdout_color_mt("console"); @@ -41,6 +45,7 @@ int main(int argc, char** argv) { ("cache", "Use a path cache for already encrypted files when multi-targeting and using hardlinks. (default: false)", cxxopts::value()->default_value("false")) ("threads", "Amount of worker threads to use. Min: 1, Max: 10", cxxopts::value()->default_value("2")) ("d,debug", "Enable debugging output (very noisy). (default: false)", cxxopts::value()->default_value("false")) + ("v,version", "Print version") ("h,help", "Print usage"); std::string input, output, rpgmaker, encryptionKey; @@ -53,6 +58,12 @@ int main(int argc, char** argv) { if (result.count("help")) { std::cout << options.help() << std::endl; + std::cout << RPGMPACKER_VERSION << std::endl; + return EXIT_SUCCESS; + } + + if (result.count("version")) { + std::cout << RPGMPACKER_VERSION << std::endl; return EXIT_SUCCESS; } @@ -129,6 +140,7 @@ var = toml::find(tomlConfig, name);\ } //input dump + logger->info("Version: {}", RPGMPACKER_VERSION); logger->info("Input: {}", input); logger->info("Output: {}", output); logger->info("RPG Maker: {}", rpgmaker);