mirror of
https://github.com/fromchat-messenger/app.git
synced 2026-11-17 11:21:37 +03:00
Fix release CI workflow and add Windows x64 installer build.
Co-authored-by: Cursor <cursoragent@cursor.com> Allow Gradle desktop builds when Android signing keys are absent. Co-authored-by: Cursor <cursoragent@cursor.com> Speed up Windows x64 CI: beta build, fix MSVC lookup on GHA. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
name: Windows x64 installer
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "App version (e.g. 1.1.4)"
|
||||
required: false
|
||||
default: "1.1.4"
|
||||
push:
|
||||
tags:
|
||||
- "win-x64-*"
|
||||
|
||||
concurrency:
|
||||
group: desktop-windows-x64-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
GRADLE_OPTS: -Dorg.gradle.jvmargs=-Xmx6g -Dkotlin.daemon.jvm.options=-Xmx6g
|
||||
|
||||
jobs:
|
||||
windows-x64:
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: "17"
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: x86_64-pc-windows-msvc
|
||||
- name: Set version
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
V="${{ inputs.version }}"
|
||||
else
|
||||
V="${GITHUB_REF_NAME#win-x64-}"
|
||||
fi
|
||||
bash scripts/ci-set-version.sh "$V"
|
||||
- name: Package Windows x64 installer
|
||||
shell: bash
|
||||
run: |
|
||||
export FROMCHAT_PACKAGING_JDK="$JAVA_HOME"
|
||||
./gradlew :app:desktop:packageBetaWindows -PbetaDesktop -PdesktopArch=x64 --no-daemon --console=plain
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: windows-x64-installer
|
||||
path: app/desktop/build/distributions/release/FromChat-Setup-*-beta2.exe
|
||||
if-no-files-found: error
|
||||
@@ -70,31 +70,41 @@ extensions.configure<ApplicationExtension> {
|
||||
}
|
||||
}
|
||||
|
||||
val keystorePropertiesFile = file("keys/keystore.properties")
|
||||
val hasReleaseKeystore = keystorePropertiesFile.isFile && file("keys/release.jks").isFile
|
||||
val hasDebugKeystore = keystorePropertiesFile.isFile && file("keys/debug.jks").isFile
|
||||
|
||||
signingConfigs {
|
||||
val keystoreProperties = Properties().apply {
|
||||
load(file("keys/keystore.properties").inputStream())
|
||||
}
|
||||
if (hasReleaseKeystore || hasDebugKeystore) {
|
||||
val keystoreProperties = Properties().apply {
|
||||
load(keystorePropertiesFile.inputStream())
|
||||
}
|
||||
|
||||
fun Properties.password(key: String): String {
|
||||
val raw = getProperty(key)
|
||||
?: error("Missing $key in keys/keystore.properties")
|
||||
return raw.trim().removeSurrounding("\"").removeSurrounding("'")
|
||||
}
|
||||
fun Properties.password(key: String): String {
|
||||
val raw = getProperty(key)
|
||||
?: error("Missing $key in keys/keystore.properties")
|
||||
return raw.trim().removeSurrounding("\"").removeSurrounding("'")
|
||||
}
|
||||
|
||||
create("release") {
|
||||
storeFile = file("keys/release.jks")
|
||||
keyAlias = "key0"
|
||||
storePassword = keystoreProperties.password("releaseStorePassword")
|
||||
keyPassword = keystoreProperties.password("releaseKeyPassword")
|
||||
enableV3Signing = true
|
||||
}
|
||||
if (hasReleaseKeystore) {
|
||||
create("release") {
|
||||
storeFile = file("keys/release.jks")
|
||||
keyAlias = "key0"
|
||||
storePassword = keystoreProperties.password("releaseStorePassword")
|
||||
keyPassword = keystoreProperties.password("releaseKeyPassword")
|
||||
enableV3Signing = true
|
||||
}
|
||||
}
|
||||
|
||||
getByName("debug") {
|
||||
storeFile = file("keys/debug.jks")
|
||||
keyAlias = "key0"
|
||||
storePassword = keystoreProperties.password("debugStorePassword")
|
||||
keyPassword = keystoreProperties.password("debugKeyPassword")
|
||||
enableV3Signing = true
|
||||
if (hasDebugKeystore) {
|
||||
getByName("debug") {
|
||||
storeFile = file("keys/debug.jks")
|
||||
keyAlias = "key0"
|
||||
storePassword = keystoreProperties.password("debugStorePassword")
|
||||
keyPassword = keystoreProperties.password("debugKeyPassword")
|
||||
enableV3Signing = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,13 +112,17 @@ extensions.configure<ApplicationExtension> {
|
||||
debug {
|
||||
applicationIdSuffix = ".beta"
|
||||
versionNameSuffix = "-beta"
|
||||
signingConfig = signingConfigs.getByName("debug")
|
||||
if (hasDebugKeystore) {
|
||||
signingConfig = signingConfigs.getByName("debug")
|
||||
}
|
||||
}
|
||||
|
||||
release {
|
||||
isMinifyEnabled = true
|
||||
isShrinkResources = true
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
if (hasReleaseKeystore) {
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
}
|
||||
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
@echo off
|
||||
setlocal EnableExtensions
|
||||
set "OUT_DIR=%~1"
|
||||
set "SRC=%~2"
|
||||
set "JAVA_HOME=%~3"
|
||||
set "ARCH=%~4"
|
||||
|
||||
if /I "%ARCH%"=="arm64" (
|
||||
set "VCVARS_NAME=vcvarsarm64.bat"
|
||||
) else (
|
||||
set "VCVARS_NAME=vcvars64.bat"
|
||||
)
|
||||
|
||||
set "VCVARS="
|
||||
if exist "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\%VCVARS_NAME%" (
|
||||
set "VCVARS=C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\%VCVARS_NAME%"
|
||||
)
|
||||
if not defined VCVARS if exist "C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\%VCVARS_NAME%" (
|
||||
set "VCVARS=C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\%VCVARS_NAME%"
|
||||
)
|
||||
if not defined VCVARS if exist "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\%VCVARS_NAME%" (
|
||||
set "VCVARS=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\%VCVARS_NAME%"
|
||||
)
|
||||
if not defined VCVARS if exist "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\%VCVARS_NAME%" (
|
||||
set "VCVARS=C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\%VCVARS_NAME%"
|
||||
)
|
||||
if not defined VCVARS if exist "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\%VCVARS_NAME%" (
|
||||
set "VCVARS=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\%VCVARS_NAME%"
|
||||
)
|
||||
if not defined VCVARS (
|
||||
for /f "delims=" %%i in ('where /r "C:\Program Files\Microsoft Visual Studio" %VCVARS_NAME% 2^>nul') do set "VCVARS=%%i"
|
||||
)
|
||||
if not defined VCVARS (
|
||||
echo compile-windows-native: %VCVARS_NAME% not found >&2
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
call "%VCVARS%"
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
if not exist "%OUT_DIR%" mkdir "%OUT_DIR%"
|
||||
cd /d "%OUT_DIR%"
|
||||
|
||||
set "JNI_INCLUDE=%JAVA_HOME%\include"
|
||||
set "JNI_WIN32=%JNI_INCLUDE%\win32"
|
||||
|
||||
cl /nologo /LD /EHsc /std:c++17 /utf-8 ^
|
||||
/I"%JNI_INCLUDE%" /I"%JNI_WIN32%" ^
|
||||
"%SRC%" /Fe:fromchat_windows.dll ^
|
||||
/link windowsapp.lib user32.lib shell32.lib ole32.lib oleaut32.lib uxtheme.lib
|
||||
if errorlevel 1 (
|
||||
echo compile-windows-native: cl failed >&2
|
||||
exit /b 1
|
||||
)
|
||||
if not exist "fromchat_windows.dll" (
|
||||
echo compile-windows-native: missing fromchat_windows.dll in %OUT_DIR% >&2
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if exist "fromchat_windows.lib" del "fromchat_windows.lib"
|
||||
if exist "fromchat_windows.exp" del "fromchat_windows.exp"
|
||||
if exist "WindowsNativeBridge.obj" del "WindowsNativeBridge.obj"
|
||||
exit /b 0
|
||||
Reference in New Issue
Block a user