generated from MechanicalFlower/godot-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use a custom export plugin to set build info (#41)
* ci: run link checker only on pull request * style: use an array like other workflows * ci: rework renovate config to use a branch name for commit * ci: load env vars before setup cache * ci: better events to start snapcraft build * chore: clean pre-commit config * chore: better gitattributes * build: add custom exportbuild info * chore: add progress bar to curl * chore: add changelog entry * chore: update credits
- Loading branch information
1 parent
0abc25d
commit ee356f7
Showing
22 changed files
with
140 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
# Properly detect languages on Github. | ||
*.gd linguist-language=GDScript | ||
|
||
# Normalize EOL for all files that Git considers text files. | ||
* text=auto eol=lf | ||
*.gd linguist-language=GDScript | ||
|
||
# The above only works properly for Git 2.10+, so for older versions | ||
# we need to manually list the binary files we don't want modified. | ||
*.mp3 binary | ||
*.png binary | ||
*.hdr binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const BUILD_INFO_VERSION := "application/config/version" | ||
const BUILD_INFO_COMMIT := "custom_options/build_info/commit" | ||
const BUILD_INFO_DATE := "custom_options/build_info/date" | ||
|
||
|
||
static func setup_build_info_settings(): | ||
var output := [] | ||
|
||
# Commit Hash | ||
OS.execute("git", ["log", '--pretty=format:"%H"', "-1"], output, false) | ||
output[0] = output[0].trim_suffix("\n") | ||
ProjectSettings.set_as_internal(BUILD_INFO_COMMIT, true) | ||
ProjectSettings.set_setting(BUILD_INFO_COMMIT, output[0]) | ||
|
||
# Datetime | ||
OS.execute("date", ["+%Y/%m/%d"], output, false) | ||
output[1] = output[1].trim_suffix("\n") | ||
ProjectSettings.set_as_internal(BUILD_INFO_DATE, true) | ||
ProjectSettings.set_setting(BUILD_INFO_DATE, output[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
extends EditorExportPlugin | ||
|
||
const BuildInfo := preload("res://addons/export-build-info/build_info.gd") | ||
|
||
|
||
func _export_begin(_features, _is_debug, _path, _flags) -> void: | ||
BuildInfo.setup_build_info_settings() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@tool | ||
extends Label | ||
|
||
const BuildInfo := preload("res://addons/export-build-info/build_info.gd") | ||
|
||
|
||
func _ready(): | ||
var build_version = ProjectSettings.get_setting(BuildInfo.BUILD_INFO_VERSION) | ||
var build_commit = ProjectSettings.get_setting(BuildInfo.BUILD_INFO_COMMIT) | ||
var build_date = ProjectSettings.get_setting(BuildInfo.BUILD_INFO_DATE) | ||
|
||
if build_version and build_commit and build_date: | ||
set_text("v%s @ %s\n%s" % [build_version, build_commit.left(7), build_date]) | ||
else: | ||
set_text("") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[plugin] | ||
|
||
name="build_info" | ||
description="" | ||
author="florianvazelle" | ||
version="0.0.0" | ||
script="plugin.gd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@tool | ||
extends EditorPlugin | ||
|
||
const BuildInfo := preload("res://addons/export-build-info/build_info.gd") | ||
|
||
var export_plugin := preload("res://addons/export-build-info/export_plugin.gd").new() | ||
|
||
|
||
func _enter_tree(): | ||
add_export_plugin(export_plugin) | ||
|
||
if Engine.is_editor_hint(): | ||
BuildInfo.setup_build_info_settings() | ||
|
||
|
||
func _exit_tree(): | ||
remove_export_plugin(export_plugin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.