-
Notifications
You must be signed in to change notification settings - Fork 11
219 lines (194 loc) · 9.76 KB
/
build.yml
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
name: Build Launcher
on:
pull_request:
push:
branches:
- "main"
workflow_dispatch:
jobs:
build:
# both Windows and Linux builds run on Ubuntu
runs-on: ${{ matrix.build == 'macos' && 'macos' || 'ubuntu' }}-latest
strategy:
fail-fast: false
matrix:
build: [macos, windows, linux]
include:
- build: linux
godot-bin: 'godot.linuxbsd.editor.x86_64.mono'
godot-template-bins: 'godot.linuxbsd.template_*'
godot-templates-dir: '/home/runner/.local/share/godot/export_templates/4.2.2.stable.mono'
- build: macos
godot-bin: 'godot.macos.editor.universal'
godot-template-bins: 'godot.macos.template_*'
godot-templates-dir: '/Users/runner/Library/Application Support/Godot/export_templates/4.2.2.stable'
# Windows build runs on Ubuntu
- build: windows
godot-bin: 'godot.linuxbsd.editor.x86_64.mono'
godot-template-bins: 'godot.windows.template_*'
godot-templates-dir: '/home/runner/.local/share/godot/export_templates/4.2.2.stable.mono'
steps:
- uses: actions/checkout@v3
- uses: chickensoft-games/setup-godot@v1
with:
version: 4.2.2
# When running on Linux, we have to use the .NET build, as this is
# the only custom build available from the CI
use-dotnet: ${{ matrix.build == 'linux' || matrix.build == 'windows' }}
include-templates: true
- name: Download Godot w/Bitcoin module
uses: robinraju/release-downloader@v1.11
with:
repository: LayerTwo-Labs/godot-bitcoin-module
tag: v4.2.2-bitcoin
filename: ${{ matrix.godot-bin }}
- name: Download Godot templates w/Bitcoin module
uses: robinraju/release-downloader@v1.11
with:
repository: LayerTwo-Labs/godot-bitcoin-module
tag: v4.2.2-bitcoin
filename: ${{ matrix.godot-template-bins }}
# FIXME: remove
- name: show files (linux / windows)
if: ${{ matrix.build == 'linux' || matrix.build == 'windows' }}
run: |
ls
echo 'TEMPLATES'
ls ${{ matrix.godot-templates-dir }}
echo 'VERSION TXT'
cat "${{ matrix.godot-templates-dir }}/version.txt"
echo $GODOT
# FIXME: remove
- name: show files (macos)
if: ${{ matrix.build == 'macos' }}
run: |
ls
#echo 'TEMPLATES'
#ls '/Users/runner/Library/Application Support/Godot/export_templates/4.2.2.stable'
#echo 'MACOS TEMPLATES'
#zipinfo -1 '/Users/runner/Library/Application Support/Godot/export_templates/4.2.2.stable/macos.zip'
#echo 'VERSION TXT'
#cat '/Users/runner/Library/Application Support/Godot/export_templates/4.2.2.stable/version.txt'
echo $GODOT
- name: Replace default templates with custom templates (linux)
if: ${{ matrix.build == 'linux' }}
run: |
rm "${{ matrix.godot-templates-dir }}/linux_debug.x86_64"
mv godot.linuxbsd.template_debug.x86_64.mono "${{ matrix.godot-templates-dir }}/linux_debug.x86_64"
rm "${{ matrix.godot-templates-dir }}/linux_release.x86_64"
mv godot.linuxbsd.template_release.x86_64.mono "${{ matrix.godot-templates-dir }}/linux_release.x86_64"
- name: Replace default templates with custom templates (macos)
if: ${{ matrix.build == 'macos' }}
run: |
# Temporary directory used to construct the zip file
TMP_ZIP_DIR=$(mktemp -d)
mkdir -p "${TMP_ZIP_DIR}/macos_template.app/Contents/MacOS"
mv "godot.macos.template_debug.universal" "${TMP_ZIP_DIR}/macos_template.app/Contents/MacOS/godot_macos_debug.universal"
mv "godot.macos.template_release.universal" "${TMP_ZIP_DIR}/macos_template.app/Contents/MacOS/godot_macos_release.universal"
zip --delete "${{ matrix.godot-templates-dir }}/macos.zip" "macos_template.app/Contents/MacOS/godot_macos_debug.universal"
zip --delete "${{ matrix.godot-templates-dir }}/macos.zip" "macos_template.app/Contents/MacOS/godot_macos_release.universal"
pushd "${TMP_ZIP_DIR}"
zip "${{ matrix.godot-templates-dir }}/macos.zip" "macos_template.app/Contents/MacOS/godot_macos_debug.universal"
zip "${{ matrix.godot-templates-dir }}/macos.zip" "macos_template.app/Contents/MacOS/godot_macos_release.universal"
popd
- name: Replace default templates with custom templates (windows)
if: ${{ matrix.build == 'windows' }}
run: |
rm "${{ matrix.godot-templates-dir }}/windows_debug_x86_64.exe"
mv "godot.windows.template_debug.x86_64.exe" "${{ matrix.godot-templates-dir }}/windows_debug_x86_64.exe"
rm "${{ matrix.godot-templates-dir }}/windows_debug_x86_64_console.exe"
mv "godot.windows.template_debug.x86_64.console.exe" "${{ matrix.godot-templates-dir }}/windows_debug_x86_64_console.exe"
rm "${{ matrix.godot-templates-dir }}/windows_release_x86_64.exe"
mv "godot.windows.template_release.x86_64.exe" "${{ matrix.godot-templates-dir }}/windows_release_x86_64.exe"
rm "${{ matrix.godot-templates-dir }}/windows_release_x86_64_console.exe"
mv "godot.windows.template_release.x86_64.console.exe" "${{ matrix.godot-templates-dir }}/windows_release_x86_64_console.exe"
# FIXME: remove
- name: show files (linux / windows)
if: ${{ matrix.build == 'linux' || matrix.build == 'windows' }}
run: |
ls
echo 'TEMPLATES'
ls ${{ matrix.godot-templates-dir }}
# FIXME: remove
- name: show files (macos)
if: ${{ matrix.build == 'macos' }}
run: |
ls
echo 'TEMPLATES'
ls '/Users/runner/Library/Application Support/Godot/export_templates/4.2.2.stable'
echo 'MACOS TEMPLATES'
zipinfo -1 '/Users/runner/Library/Application Support/Godot/export_templates/4.2.2.stable/macos.zip'
- name: Verify Setup
run: |
chmod +x ${{ matrix.godot-bin }}
mv ${{ matrix.godot-bin }} $GODOT
godot --version
- name: Import certificate to Keychain
if: ${{ matrix.build == 'macos' }}
run: |
echo "${{ secrets.MACOS_CERTIFICATE }}" | base64 --decode > certificate.p12
KEYCHAIN_PASSWORD=$(uuidgen)
security create-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
security import ./certificate.p12 -k ~/Library/Keychains/build.keychain -P ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple: -s -k "$KEYCHAIN_PASSWORD" ~/Library/Keychains/build.keychain
env:
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
- name: Setup notarization credentials
if: ${{ matrix.build == 'macos' }}
run: |
echo ${{ secrets.GODOT_MACOS_NOTARIZATION_API_KEY }} | base64 --decode > notarization_api_key.p8
# MUST be run before build
- name: Initialize godot cache
run: python3 .github/scripts/godot_ci_cache.py
- name: Export build
run: |
name="${{fromJSON('{"windows": "Windows Desktop", "macos": "macOS", "linux": "Linux/X11"}')[matrix.build] }}"
godot --headless --export-debug "$name" --verbose 2>&1 | tee build.log
env:
GODOT_MACOS_NOTARIZATION_API_KEY_ID:
${{ secrets.GODOT_MACOS_NOTARIZATION_API_KEY_ID }}
GODOT_MACOS_NOTARIZATION_API_KEY: ./notarization_api_key.p8
GODOT_MACOS_NOTARIZATION_API_UUID:
${{ secrets.GODOT_MACOS_NOTARIZATION_API_UUID }}
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: drivechain_launcher_${{ matrix.build }}
if-no-files-found: error
path: build/drivechain_launcher-*
- name: Wait for notarization to finish
if: ${{ matrix.build == 'macos' }}
run: |
request_id=$(grep 'Notarization request UUID' build.log | rev | cut -d ' ' -f 1 | rev | tr -d '"')
xcrun notarytool wait $request_id \
--issuer ${{ secrets.GODOT_MACOS_NOTARIZATION_API_UUID }} \
--key-id ${{ secrets.GODOT_MACOS_NOTARIZATION_API_KEY_ID }} \
--key ./notarization_api_key.p8
upload-artifacts-to-releases-drivechain-info:
name: Upload artifacts to releases.drivechain.info
runs-on: ubuntu-latest
needs: [build]
# avoid uploading on PRs!
if: github.event_name == 'push' && github.repository_owner == 'LayerTwo-Labs'
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Create zip files for releases.drivechain.info
run: |
mv drivechain_launcher_linux drivechain-launcher-latest-x86_64-unknown-linux-gnu
zip -r drivechain-launcher-latest-x86_64-unknown-linux-gnu.zip drivechain-launcher-latest-x86_64-unknown-linux-gnu/*
mv drivechain_launcher_macos drivechain-launcher-latest-x86_64-apple-darwin
zip -r drivechain-launcher-latest-x86_64-apple-darwin.zip drivechain-launcher-latest-x86_64-apple-darwin/*
mv drivechain_launcher_windows drivechain-launcher-latest-x86_64-w64
zip -r drivechain-launcher-latest-x86_64-w64.zip drivechain-launcher-latest-x86_64-w64/*
- name: Upload release assets to releases.drivechain.info
uses: cross-the-world/ssh-scp-ssh-pipelines@latest
with:
host: 45.33.96.47
user: root
pass: ${{ secrets.RELEASES_SERVER_PW }}
port: 22
scp: |
'drivechain-launcher-latest-*.zip' => '/var/www/html/'