Skip to content

Commit 0a5b7f0

Browse files
authored
Merge pull request #2 from outfrost/build
Copy extras into exports automatically
2 parents 7a36d0f + 68f5c52 commit 0a5b7f0

File tree

6 files changed

+115
-10
lines changed

6 files changed

+115
-10
lines changed

.github/workflows/build-release.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build and release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.*'
7+
8+
jobs:
9+
export_release_project:
10+
# Always use ubuntu-latest for this action
11+
runs-on: ubuntu-latest
12+
name: Export and release project
13+
steps:
14+
15+
- name: Checkout
16+
uses: actions/checkout@v2.3.3
17+
# Ensure that we get the entire project history
18+
with:
19+
fetch-depth: 0
20+
21+
# Job creates release under the same version as the tag
22+
- name: Get version from tag
23+
id: tag_version
24+
run: |
25+
echo ::set-output name=TAG_VERSION::${GITHUB_REF#refs/tags/v}
26+
27+
- name: Export and release
28+
uses: firebelley/godot-export@v2.6.0
29+
with:
30+
godot_executable_download_url: https://downloads.tuxfamily.org/godotengine/3.2.3/Godot_v3.2.3-stable_linux_headless.64.zip
31+
godot_export_templates_download_url: https://downloads.tuxfamily.org/godotengine/3.2.3/Godot_v3.2.3-stable_export_templates.tpz
32+
relative_project_path: ./
33+
create_release: true
34+
generate_release_notes: true
35+
base_version: ${{ steps.tag_version.outputs.TAG_VERSION }}
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build.yml

-6
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ jobs:
2626
env:
2727
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2828

29-
- name: Copy readme and license
30-
run: |
31-
for TARGET in build/*/*/; do
32-
cp LICENSE README.md screenshot.png "${TARGET}"
33-
done
34-
3529
- name: Upload Linux X11 i686 build
3630
uses: actions/upload-artifact@v2
3731
with:

addons/extras_exporter/plugin.cfg

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[plugin]
2+
3+
name="Extras Exporter"
4+
description=""
5+
author="Outfrost"
6+
version="0.1"
7+
script="plugin.gd"

addons/extras_exporter/plugin.gd

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
tool
2+
extends EditorPlugin
3+
4+
class Exporter extends EditorExportPlugin:
5+
var build_path: String
6+
var build_dir: String
7+
8+
var macos_build: bool
9+
10+
func _export_begin(features, is_debug, path, flags):
11+
if OS.has_feature("Windows"):
12+
printerr("[Extras Exporter] Running on Windows; export of additional files disabled")
13+
return
14+
15+
build_path = path
16+
build_dir = path.get_base_dir() + "/"
17+
macos_build = "OSX" in features
18+
19+
func _export_end() -> void:
20+
if OS.has_feature("Windows"):
21+
return
22+
23+
var include_files: PoolStringArray = ProjectSettings.get_setting(
24+
"extras_exporter/files_to_include")
25+
26+
print("[Extras Exporter] Build directory: ", build_dir)
27+
28+
var output = []
29+
30+
OS.execute("pwd", [], true, output)
31+
print("[Extras Exporter] Working directory: ", output[0])
32+
33+
for file in include_files:
34+
if macos_build:
35+
print("[Extras Exporter] Adding %s to macOS archive" % file)
36+
OS.execute("zip", ["-rq", build_path, file], true, output, true)
37+
else:
38+
print("[Extras Exporter] Copying %s to build directory" % file)
39+
OS.execute("cp", ["-fR", file, build_dir], true, output, true)
40+
for s in output:
41+
if !s.empty():
42+
printerr("[Extras Exporter] ", s)
43+
44+
print("[Extras Exporter] Finished")
45+
46+
var exporter = Exporter.new()
47+
48+
func _enter_tree():
49+
add_export_plugin(exporter)
50+
if !ProjectSettings.has_setting("extras_exporter/files_to_include"):
51+
ProjectSettings.set_setting(
52+
"extras_exporter/files_to_include",
53+
PoolStringArray())
54+
ProjectSettings.set_initial_value(
55+
"extras_exporter/files_to_include",
56+
PoolStringArray())
57+
58+
func _exit_tree():
59+
remove_export_plugin(exporter)

export_presets.cfg

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ runnable=true
66
custom_features=""
77
export_filter="all_resources"
88
include_filter=""
9-
exclude_filter="build/*, screenshot.png"
9+
exclude_filter="screenshot.png"
1010
export_path="build/linux_i686/bpm.x86"
1111
patch_list=PoolStringArray( )
1212
script_export_mode=1
@@ -32,7 +32,7 @@ runnable=true
3232
custom_features=""
3333
export_filter="all_resources"
3434
include_filter=""
35-
exclude_filter="build/*, screenshot.png"
35+
exclude_filter="screenshot.png"
3636
export_path="build/windows_i686/bpm.exe"
3737
patch_list=PoolStringArray( )
3838
script_export_mode=1
@@ -74,7 +74,7 @@ runnable=true
7474
custom_features=""
7575
export_filter="all_resources"
7676
include_filter=""
77-
exclude_filter="build/*, screenshot.png"
77+
exclude_filter="screenshot.png"
7878
export_path="build/macos/bpm.zip"
7979
patch_list=PoolStringArray( )
8080
script_export_mode=1
@@ -107,7 +107,7 @@ runnable=true
107107
custom_features=""
108108
export_filter="all_resources"
109109
include_filter=""
110-
exclude_filter="build/*, screenshot.png"
110+
exclude_filter="screenshot.png"
111111
export_path="build/html5/index.html"
112112
patch_list=PoolStringArray( )
113113
script_export_mode=1

project.godot

+8
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ window/size/width=640
3030
window/size/height=360
3131
window/vsync/use_vsync=false
3232

33+
[editor_plugins]
34+
35+
enabled=PoolStringArray( "extras_exporter" )
36+
37+
[extras_exporter]
38+
39+
files_to_include=PoolStringArray( "LICENSE", "README.md", "screenshot.png" )
40+
3341
[input]
3442

3543
ui_focus_next={

0 commit comments

Comments
 (0)