forked from seriouscatsoserious/Electron-DC-Launcher
-
Notifications
You must be signed in to change notification settings - Fork 0
283 lines (248 loc) · 9.47 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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
name: Build
on:
push:
branches: [ master ]
tags:
- 'v*'
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest-large, windows-latest, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build React app
env:
CI: false
run: npm run react-build
# ---------------------------------
# Windows Build
# ---------------------------------
- name: Build Electron app (Windows)
if: matrix.os == 'windows-latest'
env:
DEBUG: electron-builder
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run electron-build
# ---------------------------------
# Linux Build
# ---------------------------------
- name: Build Electron app (Linux)
if: matrix.os == 'ubuntu-latest-large'
env:
DEBUG: electron-builder
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Show electron-builder version
npx electron-builder --version
# List contents before build
ls -la
# Run build with verbose logging for Linux formats
# AppImage - Universal portable format
# DEB - Debian/Ubuntu systems
npx electron-builder --linux AppImage deb --x64
# Show build output directory
echo "Build output directory contents:"
ls -la dist/
# ---------------------------------
# macOS Build
# ---------------------------------
- name: Build & Sign Electron app (macOS)
if: matrix.os == 'macos-latest'
env:
# Provide ONLY the .p12 certificate for code signing.
CSC_LINK: ${{ secrets.MACOS_CERTIFICATE }}
CSC_KEY_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
# Remove or omit the Apple API key vars from electron-builder,
# so it doesn't attempt notarization internally.
DEBUG: electron-builder
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Remove any "notarize" block from package.json or set "notarize": false
# to ensure electron-builder won't attempt notarization automatically.
npm run electron-build
- name: Setup notarization credentials
if: matrix.os == 'macos-latest'
run: |
echo ${{ secrets.GODOT_MACOS_NOTARIZATION_API_KEY }} | base64 --decode > notarization_api_key.p8
- name: Submit app for notarization
if: matrix.os == 'macos-latest'
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 }}
run: |
# We'll assume your DMG name matches something like:
# dist/Drivechain-Launcher-<version>-x64.dmg
# If you produce multiple DMGs (x64, arm64), pick the correct one or do both.
DMG_FILE=$(ls dist/*-x64.dmg | head -n 1)
if [ -z "$DMG_FILE" ]; then
echo "No x64 DMG found to notarize!"
exit 1
fi
echo "Submitting $DMG_FILE for notarization..."
echo "Running notarytool submit..."
request_uuid=$(xcrun notarytool submit "$DMG_FILE" \
--key "$GODOT_MACOS_NOTARIZATION_API_KEY" \
--key-id "$GODOT_MACOS_NOTARIZATION_API_KEY_ID" \
--issuer "$GODOT_MACOS_NOTARIZATION_API_UUID" \
--output-format json \
| jq -r '.id')
echo "Notarization UUID: $request_uuid"
echo "Waiting for notarization to complete..."
xcrun notarytool wait "$request_uuid" \
--key "$GODOT_MACOS_NOTARIZATION_API_KEY" \
--key-id "$GODOT_MACOS_NOTARIZATION_API_KEY_ID" \
--issuer "$GODOT_MACOS_NOTARIZATION_API_UUID"
echo "Stapling notarization..."
xcrun stapler staple "$DMG_FILE"
# ---------------------------------
# Upload Artifacts
# ---------------------------------
- name: Check Linux build output
if: matrix.os == 'ubuntu-latest-large'
run: |
echo "Checking build output..."
if [ ! -d "dist" ]; then
echo "Error: dist directory not found"
exit 1
fi
find dist -type f -name "*.AppImage" || echo "No AppImage files found in dist/"
- name: Upload Linux artifacts
if: matrix.os == 'ubuntu-latest-large'
uses: actions/upload-artifact@v4
with:
name: linux-build
path: |
dist/*.AppImage
dist/*.deb
if-no-files-found: error
- name: Upload Windows artifacts
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: windows-build
path: |
dist/*.exe
if-no-files-found: error
- name: Upload macOS artifacts
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v4
with:
name: macos-build
path: |
dist/*.dmg
if-no-files-found: error
# -------------------------------------
# Separate upload-to-releases job
# -------------------------------------
upload-to-releases:
name: Upload to releases.drivechain.info
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'push' && github.repository_owner == 'LayerTwo-Labs'
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: "*-build"
path: artifacts
- name: List downloaded files
run: |
echo "Artifacts directory contents:"
ls -la artifacts
echo "Linux build directory contents:"
ls -la artifacts/linux-build
echo "Windows build directory contents:"
ls -la artifacts/windows-build
echo "macOS build directory contents:"
ls -la artifacts/macos-build
- name: Process artifacts
run: |
# Process Linux artifacts
cd artifacts/linux-build
mv *.AppImage ../../drivechain-launcher-latest-x86_64-linux.AppImage
mv *.deb ../../drivechain-launcher-latest-x86_64-linux.deb
cd ../..
# Process Windows artifact
cd artifacts/windows-build
echo "Windows build directory contents before processing:"
ls -la
# Find the exact exe file
EXE_FILE=$(ls Drivechain-Launcher-Setup-*.exe 2>/dev/null || echo "")
if [ -z "$EXE_FILE" ]; then
echo "Error: No Windows exe file found"
exit 1
fi
echo "Found Windows exe file: $EXE_FILE"
# Create zip file containing the exe
zip ../../drivechain-launcher-latest-windows.zip "$EXE_FILE"
cd ../..
# Process macOS artifacts
cd artifacts/macos-build
echo "macOS build directory contents before processing:"
ls -la
# Process arm64 DMG
ARM64_DMG=$(ls *-arm64.dmg 2>/dev/null || echo "")
if [ -z "$ARM64_DMG" ]; then
echo "Error: No arm64 DMG file found"
exit 1
fi
mv "$ARM64_DMG" ../../drivechain-launcher-latest-osx-arm64.dmg
# Process x64 DMG
X64_DMG=$(ls *-x64.dmg 2>/dev/null || echo "")
if [ -z "$X64_DMG" ]; then
echo "Error: No x64 DMG file found"
exit 1
fi
mv "$X64_DMG" ../../drivechain-launcher-latest-osx-x64.dmg
cd ../..
echo "Final files:"
ls -la drivechain-launcher-*
- name: Verify files exist
run: |
if [ ! -f "drivechain-launcher-latest-x86_64-linux.AppImage" ]; then
echo "Error: Linux AppImage file not found"
exit 1
fi
if [ ! -f "drivechain-launcher-latest-x86_64-linux.deb" ]; then
echo "Error: Linux DEB file not found"
exit 1
fi
if [ ! -f "drivechain-launcher-latest-windows.zip" ]; then
echo "Error: Windows zip file not found"
exit 1
fi
if [ ! -f "drivechain-launcher-latest-osx-arm64.dmg" ]; then
echo "Error: macOS arm64 DMG file not found"
exit 1
fi
if [ ! -f "drivechain-launcher-latest-osx-x64.dmg" ]; then
echo "Error: macOS x64 DMG file not found"
exit 1
fi
- name: Upload 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-x86_64-linux.AppImage' => '/var/www/html/'
'drivechain-launcher-latest-x86_64-linux.deb' => '/var/www/html/'
'drivechain-launcher-latest-windows.zip' => '/var/www/html/'
'drivechain-launcher-latest-osx-arm64.dmg' => '/var/www/html/'
'drivechain-launcher-latest-osx-x64.dmg' => '/var/www/html/'