Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to automate updating version number #318

Merged
merged 1 commit into from
Jul 22, 2024
Merged

Conversation

abeltrano
Copy link
Contributor

@abeltrano abeltrano commented Jul 22, 2024

Type

  • Bug fix
  • Feature addition
  • Feature update
  • Documentation
  • Build Infrastructure

Side Effects

  • Breaking change
  • Non-functional change

Goals

  • Automate updating the version as used in the project repository code.

Technical Details

  • Add new script update-version.sh in newly added scripts directory which takes as an argument a semantic version string with major, minor, and patch versions, and updates the vcpkg.json files in the project (./vcpkg.json, ./docker/netremote-dev/vcpkg.json) and the hard-coded version number in ./cmake/version.cmake.

Test Results

  • Ran with valid version string and validated the script succeeded and all files were updated:
shadowfax@foxmulder:~/src/netremote/scripts$ ./update-version.sh 1.2.3
Updating CMake version script file /home/shadowfax/src/netremote/cmake/version.cmake ... ✔
Updating version is vcpkg manifest files ... ✔
NetRemote version updated to v1.2.3

shadowfax@foxmulder:~/src/netremote$ find . -path ./vcpkg -prune -o -name vcpkg.json -exec grep -H "version-string" {} \;
./.docker/netremote-dev/vcpkg.json:  "version-string": "1.2.3",
./vcpkg.json:  "version-string": "1.2.3",

shadowfax@foxmulder:~/src/netremote$ find . -name version.cmake -exec grep -E -H "set\(VERSION_(MAJOR|MINOR|PATCH) [0-9]+" {} \;
./cmake/version.cmake:set(VERSION_MAJOR 1)
./cmake/version.cmake:set(VERSION_MINOR 2)
./cmake/version.cmake:set(VERSION_PATCH 3)
  • Ran with invalid version string and validated the script failed:
shadowfax@foxmulder:~/src/netremote/scripts$ ./update-version.sh 1.2.3.4
Invalid version: 1.2.3.4
Usage: ./update-version.sh <version major>.<version minor>.<version patch>

shadowfax@foxmulder:~/src/netremote$ find . -path ./vcpkg -prune -o -name vcpkg.json -exec grep -H "version-string" {} \;
./.docker/netremote-dev/vcpkg.json:  "version-string": "0.3.0",
./vcpkg.json:  "version-string": "0.3.0"

shadowfax@foxmulder:~/src/netremote$ find . -name version.cmake -exec grep -Eh -H "set\(VERSION_(MAJOR|MINOR|PATCH) [0-9]+" {} \;
./cmake/version.cmake:set(VERSION_MAJOR 0)
./cmake/version.cmake:set(VERSION_MINOR 3)
./cmake/version.cmake:set(VERSION_PATCH 0)

Reviewer Focus

  • None

Future Work

  • None

Checklist

  • Build target all compiles cleanly.
  • clang-format and clang-tidy deltas produced no new output.
  • Newly added functions include doxygen-style comment block.

@abeltrano abeltrano requested a review from a team as a code owner July 22, 2024 17:28
@abeltrano abeltrano merged commit b4de133 into develop Jul 22, 2024
4 checks passed
@abeltrano abeltrano deleted the addversionscript branch July 22, 2024 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant