feat(update): add self-update check via Gitea releases API
tests / build-test (push) Has been cancelled
tests / build-test (push) Has been cancelled
Adds an UpdateManager that queries the Gitea releases API once per day, stores the last check state in a JSON file, and offers to pull + rebuild the source repository when a newer version exists. The running binary is left untouched until the next launch. Also sets the app version from the version file at build time instead of the hardcoded 1.0.0, and copies the version file next to the executable.
This commit is contained in:
6 files changed
+424
-6
No files matched your search
+12
-2
@@ -8,7 +8,7 @@ set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
# Find Qt6
|
||||
find_package(Qt6 REQUIRED COMPONENTS Widgets)
|
||||
find_package(Qt6 REQUIRED COMPONENTS Widgets Network)
|
||||
|
||||
# Main executable
|
||||
set(SOURCES
|
||||
@@ -18,6 +18,7 @@ set(SOURCES
|
||||
src/plugin-manager.cpp
|
||||
src/history-manager.cpp
|
||||
src/package-model.cpp
|
||||
src/update-manager.cpp
|
||||
resources/resources.qrc
|
||||
)
|
||||
|
||||
@@ -29,15 +30,24 @@ set(HEADERS
|
||||
include/main-window.h
|
||||
include/history-manager.h
|
||||
include/package-model.h
|
||||
include/update-manager.h
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE include)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Widgets)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Widgets Qt6::Network)
|
||||
|
||||
# Copy the version file next to the executable so UpdateManager can read the
|
||||
# running build's version at runtime.
|
||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/version
|
||||
$<TARGET_FILE_DIR:${PROJECT_NAME}>/version)
|
||||
|
||||
# Install
|
||||
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
|
||||
install(FILES version DESTINATION bin)
|
||||
install(DIRECTORY include/ DESTINATION include/${PROJECT_NAME})
|
||||
|
||||
# Tests
|
||||
|
||||
Reference in new issue
Block a user