-
Notifications
You must be signed in to change notification settings - Fork 0
192 lines (167 loc) · 7.98 KB
/
build.yml
File metadata and controls
192 lines (167 loc) · 7.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: build
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
# Which godot version to use for exporting.
GODOT_VERSION: 4.6
# Which godot release to use for exporting. (stable/rc/beta/alpha)
GODOT_RELEASE: stable
# Used in the editor config file name. Do not change this for patch releases.
GODOT_FEATURE_VERSION: 4.6
# Commit hash
GODOT_COMMIT_HASH: 89cea143987d564363e15d207438530651d943ac
PROJECT_NAME: VectorTouch
BUILD_TYPE: ${{ github.event_name == 'workflow_dispatch' && 'release' || 'debug' }}
BUILD_OPTIONS: lto=full production=yes minizip=no d3d12=no vulkan=no use_volk=no disable_3d=yes disable_physics_2d=yes disable_navigation_2d=yes modules_enabled_by_default=no module_freetype_enabled=yes module_gdscript_enabled=yes module_svg_enabled=yes module_jpg_enabled=yes module_text_server_adv_enabled=yes graphite=no module_webp_enabled=yes module_mbedtls_enabled=yes swappy=no build_profile=../vectortouch/.github/disabled_classes.gdbuild
GODOT_REPO: https://github.com/godotengine/godot.git
jobs:
format:
name: File formatting (file_format.sh)
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: sudo apt-get update -qq && sudo apt-get install -yq --no-install-recommends dos2unix recode
- name: File formatting checks (file_format.sh)
run: bash ./.github/file_format.sh
build-android:
name: Export for Android
runs-on: ubuntu-latest
env:
PLATFORM: "Android"
steps:
- name: Cache Template
id: cache-template
uses: actions/cache@v3
with:
key: template-${{ env.PLATFORM }}-${{ env.GODOT_VERSION }}-${{ env.GODOT_RELEASE }}-${{ env.BUILD_TYPE }}-${{ env.BUILD_OPTIONS }}
path: |
~/.local/share/godot/export_templates/
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Set up Android SDK
uses: android-actions/setup-android@v3
- name: Check Installed Android SDK Packages
run: |
echo "Checking installed Android SDK packages..."
/usr/local/lib/android/sdk/cmdline-tools/latest/bin/sdkmanager --list_installed
- name: Set up Godot Editor
run: |
mkdir -p ~/godot-editor
cd ~/godot-editor
wget -q https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION}-${GODOT_RELEASE}/Godot_v${GODOT_VERSION}-${GODOT_RELEASE}_linux.x86_64.zip
unzip Godot_v${GODOT_VERSION}-${GODOT_RELEASE}_linux.x86_64.zip
mv ./Godot_v${GODOT_VERSION}-${GODOT_RELEASE}_linux.x86_64 ~/godot-editor/godot
echo "~/godot-editor" >> $GITHUB_PATH
- if: ${{ steps.cache-template.outputs.cache-hit != 'true' }}
name: Install dependencies
run: sudo apt-get install -y scons python3
- if: ${{ steps.cache-template.outputs.cache-hit != 'true' }}
name: Clone Godot repository
run: git clone $GODOT_REPO godot
- if: ${{ steps.cache-template.outputs.cache-hit != 'true' }}
name: Checkout specific commit
run: |
cd godot
git fetch
git checkout $GODOT_COMMIT_HASH
- name: Checkout repository
uses: actions/checkout@v4
with:
path: vectortouch
- if: ${{ steps.cache-template.outputs.cache-hit != 'true' && env.BUILD_TYPE == 'debug' }}
name: Build Godot debug template for Android
run: |
cd godot
scons p=android arch=arm64 ${BUILD_OPTIONS} target=template_debug generate_android_binaries=yes
mkdir -p ~/.local/share/godot/export_templates/${GODOT_VERSION}.${GODOT_RELEASE}/
mv ./bin/android_debug.apk ~/.local/share/godot/export_templates/${GODOT_VERSION}.${GODOT_RELEASE}/android_debug.apk
mv ./bin/android_source.zip ~/.local/share/godot/export_templates/${GODOT_VERSION}.${GODOT_RELEASE}/android_source_debug.zip
- if: ${{ steps.cache-template.outputs.cache-hit != 'true' && env.BUILD_TYPE == 'release' }}
name: Build Godot release template for Android
run: |
cd godot
scons p=android arch=x86_64 ${BUILD_OPTIONS} lto=thin target=template_release debug_symbols=yes
scons p=android arch=arm32 ${BUILD_OPTIONS} target=template_release debug_symbols=yes
scons p=android arch=arm64 ${BUILD_OPTIONS} target=template_release debug_symbols=yes separate_debug_symbols=yes generate_android_binaries=yes
mkdir -p ~/.local/share/godot/export_templates/${GODOT_VERSION}.${GODOT_RELEASE}/
mv ./bin/android_release.apk ~/.local/share/godot/export_templates/${GODOT_VERSION}.${GODOT_RELEASE}/android_release.apk
mv ./bin/android_source.zip ~/.local/share/godot/export_templates/${GODOT_VERSION}.${GODOT_RELEASE}/android_source.zip
mv ./bin/android-template-release-native-symbols.zip ~/.local/share/godot/export_templates/${GODOT_VERSION}.${GODOT_RELEASE}/native_debug_symbols.zip
- name: Set up android build template
run: |
TEMPLATE="android_source.zip"
if [ "${BUILD_TYPE}" = "debug" ]; then
TEMPLATE="android_source_debug.zip"
fi
cd vectortouch
mkdir -p android/build
unzip -q ~/.local/share/godot/export_templates/${GODOT_VERSION}.${GODOT_RELEASE}/${TEMPLATE} -d android/build
touch android/build/.gdignore
echo "${GODOT_VERSION}.${GODOT_RELEASE}" > android/.build_version
- name: Add splash_anim.xml and patch GodotApp.java file
run: |
cd vectortouch
mkdir -p android/build/res/drawable
cp godot_only/splash_anim.xml android/build/res/drawable/splash_anim.xml
patch "android/build/src/main/java/com/godot/game/GodotApp.java" "godot_only/GodotApp.patch"
- name: Export debug project
if: env.BUILD_TYPE == 'debug'
env:
GODOT_ANDROID_KEYSTORE_DEBUG_PATH: "./godot_only/debug.keystore"
GODOT_ANDROID_KEYSTORE_DEBUG_USER: "androiddebugkey"
GODOT_ANDROID_KEYSTORE_DEBUG_PASSWORD: "android"
run: |
cd vectortouch
mkdir -p artifacts
godot --headless --export-debug "Android-debug" artifacts/VectorTouch-debug.apk
- name: Export release project
if: env.BUILD_TYPE == 'release'
env:
GODOT_ANDROID_KEYSTORE_RELEASE_PATH: "/tmp/release.keystore"
GODOT_ANDROID_KEYSTORE_RELEASE_USER: ${{ secrets.KEY_ALIAS }}
GODOT_ANDROID_KEYSTORE_RELEASE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
run: |
cd vectortouch
mkdir -p artifacts
echo "${{ secrets.KEYSTORE }}" | base64 -d > /tmp/release.keystore
godot --headless --export-release "Android" artifacts/VectorTouch.apk
godot --headless --export-release "Android-aab" artifacts/VectorTouch.aab
- name: Upload debug apk
uses: actions/upload-artifact@v4
with:
name: ${{ env.PROJECT_NAME }}-debug
path: vectortouch/artifacts/VectorTouch-debug.apk
if-no-files-found: ignore
retention-days: 28
- name: Upload release apk
uses: actions/upload-artifact@v4
with:
name: ${{ env.PROJECT_NAME }}
path: vectortouch/artifacts/VectorTouch.apk
if-no-files-found: ignore
retention-days: 28
- name: Upload release aab
uses: actions/upload-artifact@v4
with:
name: ${{ env.PROJECT_NAME }}-aab
path: vectortouch/artifacts/VectorTouch.aab
if-no-files-found: ignore
retention-days: 28
- name: Upload debug symbols
uses: actions/upload-artifact@v4
with:
name: native_debug_symbols.zip
path: ~/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.${{ env.GODOT_RELEASE }}/native_debug_symbols.zip
if-no-files-found: ignore
retention-days: 28