From 97c2371b35edb2f95e0952c93df863dfb467d000 Mon Sep 17 00:00:00 2001 From: florianvazelle Date: Fri, 22 Mar 2024 21:32:30 +0100 Subject: [PATCH] feat: add quiver analytics --- .github/workflows/release-packaging.yml | 10 ++++++++-- .godot/global_script_class_cache.cfg | 6 ++++++ Justfile | 4 ++++ plug.gd | 7 +++++++ project.godot | 11 ++++++++--- scripts/player/inventory.gd | 1 + scripts/scenario.gd | 2 ++ 7 files changed, 36 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-packaging.yml b/.github/workflows/release-packaging.yml index 2ff9ebf..aa13de4 100644 --- a/.github/workflows/release-packaging.yml +++ b/.github/workflows/release-packaging.yml @@ -5,7 +5,7 @@ on: # Ensure the build works on main push: branches: [main] - tags: + tags: ['*'] # Ensure the build works on each pull request pull_request: @@ -76,6 +76,9 @@ jobs: - name: Load dotenv run: just ci-load-dotenv + - name: Setup Quiver + run: just quiver ${{ secrets.QUIVER_AUTH_TOKEN }} + - name: Cache Godot uses: actions/cache@v4 with: @@ -113,6 +116,9 @@ jobs: - name: Load dotenv run: just ci-load-dotenv + - name: Setup Quiver + run: just quiver ${{ secrets.QUIVER_AUTH_TOKEN }} + - name: Download artifact uses: dawidd6/action-download-artifact@v3 with: @@ -125,4 +131,4 @@ jobs: run: just ci-publish env: BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.PAT }} diff --git a/.godot/global_script_class_cache.cfg b/.godot/global_script_class_cache.cfg index 1dfd26b..0642b0e 100644 --- a/.godot/global_script_class_cache.cfg +++ b/.godot/global_script_class_cache.cfg @@ -35,6 +35,12 @@ list=Array[Dictionary]([{ "language": &"GDScript", "path": "res://addons/logger/config.gd" }, { +"base": &"CanvasLayer", +"class": &"ConsentDialog", +"icon": "", +"language": &"GDScript", +"path": "res://addons/quiver_analytics/consent_dialog.gd" +}, { "base": &"Observable", "class": &"DarkRoad", "icon": "", diff --git a/Justfile b/Justfile index d69a0e7..64e87fd 100644 --- a/Justfile +++ b/Justfile @@ -196,6 +196,10 @@ butler *ARGS: check-butler echo "Update version in the project.godot" sed -i "s,config/version=.*$,config/version=\"{{ game_version }}\",g" ./project.godot +@quiver $QUIVER_AUTH_TOKEN: + echo "Add Quiver authentification token in the project.godot" + sed -i "s,REPLACE_ME,"$QUIVER_AUTH_TOKEN",g" ./project.godot + [private] pre-export: clean-addons makedirs bump-version install-addons import-resources diff --git a/plug.gd b/plug.gd index 1ace57f..3c0511a 100644 --- a/plug.gd +++ b/plug.gd @@ -30,6 +30,13 @@ func _plugging(): "include": ["addons/kanban_tasks"] } ) + plug( + "quiver-dev/quiver-analytics-godot-plugin", + { + "commit": "7430a4533911701845c3f1f59945543d63962263", + "renovate-branch": "main", + } + ) # Patched version plug( diff --git a/project.godot b/project.godot index 5f207e5..b4a4a6e 100644 --- a/project.godot +++ b/project.godot @@ -36,11 +36,12 @@ GlobalSignal="*res://scripts/framework/global_signal.gd" GameState="*res://scripts/framework/game_state.gd" MenuTemplateManager="*res://addons/EasyMenus/Nodes/menu_template_manager.tscn" Log="*res://addons/logger/logger.gd" +Analytics="*res://addons/quiver_analytics/analytics.tscn" [custom_options] -build_info/commit="a9602d15680d01d0406f54ed85a3d02b4ab69d4f" -build_info/date="2024/02/10" +build_info/commit="a340227663d7250445ca4ac8b0f59f41b64e9a03" +build_info/date="2024/03/22" [display] @@ -53,7 +54,7 @@ export/convert_text_resources_to_binary=false [editor_plugins] -enabled=PackedStringArray("res://addons/debug_menu/plugin.cfg", "res://addons/dialogue_label/plugin.cfg", "res://addons/export-build-info/plugin.cfg", "res://addons/kanban_tasks/plugin.cfg", "res://addons/logger/plugin.cfg", "res://addons/proton_scatter/plugin.cfg") +enabled=PackedStringArray("res://addons/debug_menu/plugin.cfg", "res://addons/dialogue_label/plugin.cfg", "res://addons/export-build-info/plugin.cfg", "res://addons/kanban_tasks/plugin.cfg", "res://addons/logger/plugin.cfg", "res://addons/proton_scatter/plugin.cfg", "res://addons/quiver_analytics/plugin.cfg") [filesystem] @@ -146,6 +147,10 @@ locale/translations=PackedStringArray("res://assets/i18n/locale.fr.translation", 3d_physics/layer_2="Player" 3d_physics/layer_3="Floor" +[quiver] + +general/auth_token="REPLACE_ME" + [rendering] occlusion_culling/bvh_build_quality=0 diff --git a/scripts/player/inventory.gd b/scripts/player/inventory.gd index 4c1f1d1..c207311 100644 --- a/scripts/player/inventory.gd +++ b/scripts/player/inventory.gd @@ -22,6 +22,7 @@ func _on_Accessory_current_item_updated(new_current_item: StringName): fuse.show() &"tire": tire.show() + await Analytics.add_event("current_item_updated", {"game_version": ProjectSettings.get("application/config/version"), "item_name": new_current_item}) func hide_all(): diff --git a/scripts/scenario.gd b/scripts/scenario.gd index d398e39..e1fa9fb 100644 --- a/scripts/scenario.gd +++ b/scripts/scenario.gd @@ -22,6 +22,7 @@ func _ready(): func _on_Scenario_animation_finished(anim_name: StringName): if anim_name == &"intro": + await Analytics.add_event("Start the game", {"game_version": ProjectSettings.get("application/config/version")}) camera_car.get_parent().get_node("Engine").stop() # Transition that launch the playable game @@ -29,6 +30,7 @@ func _on_Scenario_animation_finished(anim_name: StringName): player.set_process_mode(PROCESS_MODE_INHERIT) elif anim_name == &"outro": + await Analytics.add_event("Finish the game", {"game_version": ProjectSettings.get("application/config/version")}) await Fade.fade_out(1, Color.BLACK, "Diamond", false, false).finished get_tree().change_scene_to_file("res://scenes/menu.tscn")