mirror of
https://github.com/fromchat-messenger/app.git
synced 2026-11-16 02:44:54 +03:00
577989fc78
Skip Kotlin Native link and unsigned IPA packaging in release builds; publish Android, desktop, and Linux artifacts only. Co-authored-by: Cursor <cursoragent@cursor.com>
746 lines
30 KiB
YAML
746 lines
30 KiB
YAML
# Release builds run on workflow_dispatch only — never on tag pushes.
|
|
#
|
|
# Why: workflow-run caches are scoped by ref. A run can only restore caches saved for its own ref
|
|
# or for the default branch ("Restrictions for accessing a cache"), and a save made during a
|
|
# tag-triggered run is pinned to that tag and reusable by nobody — every release tag would start
|
|
# cold and never warm another build. Dispatching from the default branch makes every save land in
|
|
# the default-branch scope, which all future runs can restore. The tag does not have to exist
|
|
# beforehand: the publish step creates it (pointing at the commit that was built). Dispatch from a
|
|
# non-default branch still works (hotfix betas), but its saves are scoped to that branch only,
|
|
# so it never warms and never reuses the shared cache — resolve-version warns about it.
|
|
name: Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: "Version to build (e.g. 1.2.0-beta)"
|
|
required: true
|
|
type: string
|
|
skip_publish:
|
|
description: "Build only; do not publish a GitHub Release"
|
|
required: false
|
|
type: choice
|
|
options:
|
|
- "false"
|
|
- "true"
|
|
default: "false"
|
|
force_update_release:
|
|
description: "Publish even when a release already exists (skips build if inputs unchanged)"
|
|
required: false
|
|
type: choice
|
|
options:
|
|
- "false"
|
|
- "true"
|
|
default: "false"
|
|
rebuild:
|
|
description: "Force a full rebuild even when build inputs are unchanged"
|
|
required: false
|
|
type: choice
|
|
options:
|
|
- "false"
|
|
- "true"
|
|
default: "false"
|
|
|
|
concurrency:
|
|
group: release
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
GRADLE_OPTS: >-
|
|
-Dorg.gradle.jvmargs=-Xmx6g
|
|
-Dkotlin.daemon.jvm.options=-Xmx6g
|
|
-Dorg.gradle.parallel=true
|
|
|
|
jobs:
|
|
resolve-version:
|
|
name: Resolve version and check build inputs
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
outputs:
|
|
version: ${{ steps.ver.outputs.version }}
|
|
tag: ${{ steps.ver.outputs.tag }}
|
|
prerelease: ${{ steps.ver.outputs.prerelease }}
|
|
release_label: ${{ steps.ver.outputs.release_label }}
|
|
force_update_release: ${{ steps.ver.outputs.force_update_release }}
|
|
should_build: ${{ steps.decide.outputs.should_build }}
|
|
inputs_hash: ${{ steps.hash.outputs.hash }}
|
|
steps:
|
|
- id: ver
|
|
shell: bash
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
V="${{ github.event.inputs.version }}"
|
|
if [ "${{ github.ref_name }}" != "${{ github.event.repository.default_branch }}" ]; then
|
|
echo "::warning::Dispatched from '${{ github.ref_name }}' instead of the default branch ('${{ github.event.repository.default_branch }}'). Caches saved by this run are scoped to '${{ github.ref_name }}' and invisible to future runs — dispatch from '${{ github.event.repository.default_branch }}' to keep the build caches reusable."
|
|
fi
|
|
if [[ ! "$V" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-].*)?$ ]]; then
|
|
echo "Invalid version: $V" >&2
|
|
exit 1
|
|
fi
|
|
if [[ ! "$V" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then
|
|
echo "Cannot derive release label from version: $V" >&2
|
|
exit 1
|
|
fi
|
|
MAJOR="${BASH_REMATCH[1]}"
|
|
MINOR="${BASH_REMATCH[2]}"
|
|
PATCH="${BASH_REMATCH[3]}"
|
|
if [[ "$PATCH" == "0" ]]; then
|
|
RELEASE_LABEL="${MAJOR}.${MINOR}"
|
|
else
|
|
RELEASE_LABEL="${MAJOR}.${MINOR}.${PATCH}"
|
|
fi
|
|
TAG="v$V"
|
|
echo "version=$V" >> "$GITHUB_OUTPUT"
|
|
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
|
|
echo "release_label=$RELEASE_LABEL" >> "$GITHUB_OUTPUT"
|
|
case "$V" in
|
|
*-beta*) echo "prerelease=true" >> "$GITHUB_OUTPUT" ;;
|
|
*) echo "prerelease=false" >> "$GITHUB_OUTPUT" ;;
|
|
esac
|
|
if gh release view "$TAG" >/dev/null 2>&1; then
|
|
if [ "${{ github.event.inputs.force_update_release }}" = "true" ]; then
|
|
echo "Release $TAG exists; force_update_release enabled."
|
|
echo "force_update_release=true" >> "$GITHUB_OUTPUT"
|
|
elif [ "${{ github.event.inputs.skip_publish }}" = "true" ]; then
|
|
echo "Release $TAG exists; skip_publish enabled — build only."
|
|
echo "force_update_release=false" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "Release $TAG already exists. Use force_update_release=true to republish or skip_publish=true to build only." >&2
|
|
exit 1
|
|
fi
|
|
else
|
|
echo "force_update_release=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- uses: actions/checkout@v5
|
|
- uses: ./.github/actions/hash-release-build-inputs
|
|
id: hash
|
|
- uses: actions/cache/restore@v5
|
|
id: built
|
|
with:
|
|
path: .release-built-marker
|
|
key: release-built-${{ steps.ver.outputs.tag }}-${{ steps.hash.outputs.hash }}
|
|
lookup-only: true
|
|
- id: decide
|
|
shell: bash
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
TAG: ${{ steps.ver.outputs.tag }}
|
|
run: |
|
|
set -euo pipefail
|
|
if [ "${{ github.event.inputs.rebuild }}" = "true" ]; then
|
|
echo "should_build=true" >> "$GITHUB_OUTPUT"
|
|
exit 0
|
|
fi
|
|
if [ "${{ steps.built.outputs.cache-hit }}" != "true" ]; then
|
|
echo "should_build=true" >> "$GITHUB_OUTPUT"
|
|
exit 0
|
|
fi
|
|
if gh release view "$TAG" >/dev/null 2>&1; then
|
|
echo "Build inputs unchanged for $TAG; skipping build jobs."
|
|
echo "should_build=false" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "Build inputs unchanged but release $TAG is missing; rebuilding."
|
|
echo "should_build=true" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
desktop-proguard:
|
|
name: Build JAR
|
|
needs: resolve-version
|
|
if: needs.resolve-version.outputs.should_build == 'true'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 45
|
|
env:
|
|
FROMCHAT_PREBUILT_PROGUARD: "0"
|
|
ORG_GRADLE_PROJECT_org.gradle.workers.max: "4"
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: ./.github/actions/restore-git-mtimes
|
|
- uses: ./.github/actions/set-version
|
|
with:
|
|
version: ${{ needs.resolve-version.outputs.version }}
|
|
- uses: ./.github/actions/setup-java-gradle
|
|
with:
|
|
desktop-jdk: "25"
|
|
- uses: ./.github/actions/cache-gradle-build
|
|
id: gradle-build-cache
|
|
with:
|
|
scope: build-jar
|
|
- name: Compile and ProGuard release desktop jars
|
|
run: ./gradlew :app:desktop:exportReleaseProguardForCi --no-daemon --console=plain
|
|
- name: Archive JVM compile outputs
|
|
run: |
|
|
set -euo pipefail
|
|
tar -czf jvm-compile-outputs.tar.gz \
|
|
app/shared/build \
|
|
app/desktop/build/classes \
|
|
app/desktop/build/libs
|
|
- uses: ./.github/actions/save-gradle-build-cache
|
|
if: always()
|
|
with:
|
|
scope: ${{ steps.gradle-build-cache.outputs.cache-save-scope }}
|
|
- uses: actions/upload-artifact@v5
|
|
with:
|
|
name: desktop-proguard
|
|
path: app/desktop/build/ci/proguard/
|
|
if-no-files-found: error
|
|
retention-days: 3
|
|
- uses: actions/upload-artifact@v5
|
|
with:
|
|
name: jvm-compile-outputs
|
|
path: jvm-compile-outputs.tar.gz
|
|
if-no-files-found: error
|
|
retention-days: 3
|
|
|
|
windows-tools:
|
|
name: Windows tools (${{ matrix.label }})
|
|
needs: resolve-version
|
|
if: needs.resolve-version.outputs.should_build == 'true'
|
|
timeout-minutes: 45
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- arch: x64
|
|
label: x64
|
|
runner: windows-latest
|
|
rust-target: x86_64-pc-windows-msvc
|
|
java-distribution: temurin
|
|
- arch: arm64
|
|
label: ARM
|
|
runner: windows-11-arm
|
|
rust-target: aarch64-pc-windows-msvc
|
|
# Adoptium publishes no Windows aarch64 build for 17, hence zulu. See the ARM leg of
|
|
# windows-package for why the Gradle JVM must not be 21+ on Windows ARM64.
|
|
java-distribution: zulu
|
|
runs-on: ${{ matrix.runner }}
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: ./.github/actions/restore-git-mtimes
|
|
- uses: ./.github/actions/set-version
|
|
with:
|
|
version: ${{ needs.resolve-version.outputs.version }}
|
|
# This job only needs a JVM to drive cargo; the app image is packaged by windows-package.
|
|
- uses: ./.github/actions/setup-java-gradle
|
|
with:
|
|
java-distribution: ${{ matrix.java-distribution }}
|
|
- uses: ./.github/actions/cache-gradle-build
|
|
id: gradle-build-cache
|
|
with:
|
|
scope: windows-tools-${{ matrix.arch }}
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.rust-target }}
|
|
- uses: ./.github/actions/cache-windows-rust-tools
|
|
- name: Verify Windows Rust binaries
|
|
id: rust-binaries
|
|
shell: bash
|
|
run: |
|
|
ready=true
|
|
for exe in \
|
|
FromChat-Installer.exe \
|
|
FromChat-Installer-Helper.exe \
|
|
fromchat-portable-launcher.exe \
|
|
fromchat-pack.exe \
|
|
fromchat-icon-patch.exe
|
|
do
|
|
if [[ ! -f "app/desktop/windows-setup/target/release/$exe" ]]; then
|
|
echo "Missing $exe"
|
|
ready=false
|
|
fi
|
|
done
|
|
echo "ready=$ready" >> "$GITHUB_OUTPUT"
|
|
# cargo builds for the host, so each runner produces tooling for its own architecture. That
|
|
# matters: fromchat-pack picks the embedded payload with std::env::consts::ARCH, the stub's
|
|
# compile-time arch, so an x64 stub running emulated on ARM64 looks for an x86_64 payload the
|
|
# ARM64 bundle does not contain ("installer has no payload for this CPU (x86_64)").
|
|
- name: Build Windows installer Rust tooling
|
|
if: steps.rust-binaries.outputs.ready != 'true'
|
|
shell: bash
|
|
run: ./gradlew :app:desktop:buildWindowsSetupRust --no-daemon --console=plain
|
|
- uses: ./.github/actions/save-windows-rust-cache
|
|
if: always()
|
|
- uses: actions/upload-artifact@v5
|
|
with:
|
|
name: windows-rust-tools-${{ matrix.arch }}
|
|
path: app/desktop/windows-setup/target/release/*.exe
|
|
if-no-files-found: error
|
|
retention-days: 3
|
|
- uses: ./.github/actions/save-gradle-build-cache
|
|
if: always()
|
|
with:
|
|
scope: ${{ steps.gradle-build-cache.outputs.cache-save-scope }}
|
|
|
|
windows-package:
|
|
name: Windows (${{ matrix.label }})
|
|
needs: [resolve-version, desktop-proguard, windows-tools]
|
|
if: needs.resolve-version.outputs.should_build == 'true'
|
|
env:
|
|
FROMCHAT_PREBUILT_PROGUARD: "1"
|
|
FROMCHAT_PREBUILT_JVM: "1"
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- arch: x64
|
|
label: x64
|
|
runner: windows-latest
|
|
java-distribution: temurin
|
|
- arch: arm64
|
|
label: ARM
|
|
runner: windows-11-arm
|
|
# JDK-8371740: a LinkedTransferQueue race, fixed only in JDK 26, makes Gradle on
|
|
# Windows ARM64 hang at build shutdown ("Timeout waiting for concurrent jobs to
|
|
# complete") whenever it runs on JDK 21+. This runner's ambient JAVA_HOME is Temurin
|
|
# 21.0.12, so pin the Gradle JVM to 17 — exactly what the x64 leg does. Adoptium
|
|
# publishes no Windows aarch64 build for 17, hence zulu. Packaging is unaffected:
|
|
# resolvePackagingJdkHome() rejects 17 as too old and falls back to the Java 25
|
|
# toolchain JDK for jpackage.
|
|
java-distribution: zulu
|
|
runs-on: ${{ matrix.runner }}
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: ./.github/actions/restore-git-mtimes
|
|
- uses: ./.github/actions/set-version
|
|
with:
|
|
version: ${{ needs.resolve-version.outputs.version }}
|
|
- name: Ensure ARM64 packaging JDK
|
|
if: matrix.arch == 'arm64'
|
|
shell: cmd
|
|
run: call scripts\ensure-windows-arm64-jdk.cmd
|
|
- uses: ./.github/actions/setup-java-gradle
|
|
with:
|
|
cache-read-only: "true"
|
|
java-distribution: ${{ matrix.java-distribution }}
|
|
- uses: ./.github/actions/cache-gradle-build
|
|
id: gradle-build-cache
|
|
with:
|
|
scope: windows-package-${{ matrix.arch }}
|
|
- uses: actions/download-artifact@v5
|
|
with:
|
|
name: desktop-proguard
|
|
path: app/desktop/build/prebuilt/main-release/proguard
|
|
- uses: actions/download-artifact@v5
|
|
with:
|
|
name: jvm-compile-outputs
|
|
path: .
|
|
- uses: ./.github/actions/restore-jvm-compile-outputs
|
|
# Tooling for this architecture, built natively by the windows-tools matrix leg. The two
|
|
# architectures must not share: fromchat-pack selects the embedded payload with
|
|
# std::env::consts::ARCH, so an x64 stub on ARM64 reports "x86_64" and finds no x86_64
|
|
# payload in the ARM-only bundle.
|
|
- name: Restore Windows Rust installer tools
|
|
uses: actions/download-artifact@v5
|
|
with:
|
|
name: windows-rust-tools-${{ matrix.arch }}
|
|
path: app/desktop/windows-setup/target/release
|
|
- name: Package Windows ${{ matrix.arch }} installer
|
|
shell: bash
|
|
env:
|
|
FROMCHAT_SKIP_RUST_BUILD: "1"
|
|
run: |
|
|
export FROMCHAT_PACKAGING_JDK="$JAVA_HOME"
|
|
args=(
|
|
:app:desktop:packSetupOnly
|
|
"-PdesktopArch=${{ matrix.arch }}"
|
|
--no-daemon
|
|
--console=plain
|
|
)
|
|
if [ "${{ matrix.arch }}" = "arm64" ]; then
|
|
args+=("-PwindowsArm64")
|
|
fi
|
|
./gradlew "${args[@]}"
|
|
- uses: actions/upload-artifact@v5
|
|
with:
|
|
name: windows-${{ matrix.arch }}
|
|
path: app/desktop/build/distributions/release/*-windows-${{ matrix.arch }}.exe
|
|
if-no-files-found: error
|
|
- uses: ./.github/actions/save-gradle-build-cache
|
|
if: always()
|
|
with:
|
|
scope: ${{ steps.gradle-build-cache.outputs.cache-save-scope }}
|
|
|
|
macos:
|
|
name: macOS (${{ matrix.label }})
|
|
needs: [resolve-version, desktop-proguard]
|
|
if: needs.resolve-version.outputs.should_build == 'true'
|
|
env:
|
|
FROMCHAT_PREBUILT_PROGUARD: "1"
|
|
FROMCHAT_PREBUILT_JVM: "1"
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- arch: arm64
|
|
label: Apple Silicon
|
|
runner: macos-latest
|
|
# jpackage cannot cross-build: on an arm64 runner this job silently ships
|
|
# arm64 binaries under the -intel.dmg name (beta18 did exactly that).
|
|
- arch: x64
|
|
label: Intel
|
|
runner: macos-26-intel
|
|
runs-on: ${{ matrix.runner }}
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: ./.github/actions/restore-git-mtimes
|
|
- uses: ./.github/actions/set-version
|
|
with:
|
|
version: ${{ needs.resolve-version.outputs.version }}
|
|
- uses: ./.github/actions/setup-java-gradle
|
|
if: matrix.arch == 'x64'
|
|
with:
|
|
java-architecture: x64
|
|
cache-read-only: "true"
|
|
- uses: ./.github/actions/setup-java-gradle
|
|
if: matrix.arch == 'arm64'
|
|
with:
|
|
cache-read-only: "true"
|
|
- uses: ./.github/actions/cache-gradle-build
|
|
id: gradle-build-cache
|
|
with:
|
|
scope: macos-${{ matrix.arch }}
|
|
- uses: actions/download-artifact@v5
|
|
with:
|
|
name: desktop-proguard
|
|
path: app/desktop/build/prebuilt/main-release/proguard
|
|
- uses: actions/download-artifact@v5
|
|
with:
|
|
name: jvm-compile-outputs
|
|
path: .
|
|
- uses: ./.github/actions/restore-jvm-compile-outputs
|
|
- name: Cache DMG background tooling
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: |
|
|
app/desktop/dmg-background/node_modules
|
|
app/desktop/dmg-background/.playwright-browsers
|
|
key: dmg-tools-${{ runner.arch }}-${{ hashFiles('app/desktop/dmg-background/package-lock.json') }}
|
|
restore-keys: dmg-tools-${{ runner.arch }}-
|
|
- name: Cache DMG export output
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: app/desktop/build/dmg-background/dist
|
|
key: dmg-export-${{ runner.arch }}-${{ hashFiles('app/desktop/dmg-background/**', 'app/shared/src/commonMain/composeResources/drawable/logo_square.png') }}
|
|
restore-keys: dmg-export-${{ runner.arch }}-
|
|
- name: Install macOS packaging tools
|
|
env:
|
|
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/app/desktop/dmg-background/.playwright-browsers
|
|
run: |
|
|
if ! command -v create-dmg >/dev/null 2>&1; then
|
|
brew install create-dmg
|
|
fi
|
|
DMG_DIR="app/desktop/dmg-background"
|
|
mkdir -p "$PLAYWRIGHT_BROWSERS_PATH"
|
|
if [[ ! -f "$DMG_DIR/node_modules/playwright/package.json" ]]; then
|
|
npm --prefix "$DMG_DIR" ci --no-fund --no-audit
|
|
fi
|
|
npm --prefix "$DMG_DIR" exec playwright install chromium
|
|
echo "FROMCHAT_DMG_TOOLS_READY=1" >> "$GITHUB_ENV"
|
|
echo "PLAYWRIGHT_BROWSERS_PATH=$PLAYWRIGHT_BROWSERS_PATH" >> "$GITHUB_ENV"
|
|
- name: Package macOS ${{ matrix.arch }}
|
|
run: |
|
|
export FROMCHAT_PACKAGING_JDK="$JAVA_HOME"
|
|
./gradlew :app:desktop:packageReleaseMac -PdesktopArch=${{ matrix.arch }} --no-daemon --console=plain
|
|
# jpackage only reports its error text in files on the runner surface — surface them.
|
|
- name: Dump jpackage logs on failure
|
|
if: failure()
|
|
run: |
|
|
for t in createReleaseDistributable createDmgOther; do
|
|
D="app/desktop/build/compose/logs/$t"
|
|
[[ -d "$D" ]] || continue
|
|
for f in "$D"/*.txt; do
|
|
echo "===== $f"
|
|
cat "$f"
|
|
done
|
|
done
|
|
- uses: actions/upload-artifact@v5
|
|
with:
|
|
name: macos-${{ matrix.arch }}
|
|
path: app/desktop/build/distributions/release/*-macOS-${{ matrix.arch }}.dmg
|
|
if-no-files-found: error
|
|
- uses: ./.github/actions/save-gradle-build-cache
|
|
if: always()
|
|
with:
|
|
scope: ${{ steps.gradle-build-cache.outputs.cache-save-scope }}
|
|
|
|
linux:
|
|
name: Linux (${{ matrix.label }})
|
|
needs: [resolve-version, desktop-proguard]
|
|
if: needs.resolve-version.outputs.should_build == 'true'
|
|
env:
|
|
FROMCHAT_PREBUILT_PROGUARD: "1"
|
|
FROMCHAT_PREBUILT_JVM: "1"
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- arch: x64
|
|
label: x64
|
|
runner: ubuntu-latest
|
|
appimage: appimagetool-x86_64.AppImage
|
|
- arch: arm64
|
|
label: ARM
|
|
runner: ubuntu-24.04-arm
|
|
appimage: appimagetool-aarch64.AppImage
|
|
runs-on: ${{ matrix.runner }}
|
|
timeout-minutes: 45
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: ./.github/actions/restore-git-mtimes
|
|
- uses: ./.github/actions/set-version
|
|
with:
|
|
version: ${{ needs.resolve-version.outputs.version }}
|
|
- uses: ./.github/actions/setup-java-gradle
|
|
with:
|
|
cache-read-only: "true"
|
|
desktop-jdk: "25"
|
|
- uses: ./.github/actions/cache-gradle-build
|
|
id: gradle-build-cache
|
|
with:
|
|
scope: linux-${{ matrix.arch }}
|
|
- uses: actions/download-artifact@v5
|
|
with:
|
|
name: desktop-proguard
|
|
path: app/desktop/build/prebuilt/main-release/proguard
|
|
- uses: actions/download-artifact@v5
|
|
with:
|
|
name: jvm-compile-outputs
|
|
path: .
|
|
- uses: ./.github/actions/restore-jvm-compile-outputs
|
|
- name: Install Linux packaging tools
|
|
run: |
|
|
sudo apt-get update
|
|
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
|
fakeroot rpm binutils libfuse2 wget
|
|
CACHE_DIR="${RUNNER_TOOL_CACHE}/appimagetool"
|
|
mkdir -p "$CACHE_DIR"
|
|
TOOL="$CACHE_DIR/appimagetool-${{ matrix.arch }}.AppImage"
|
|
if [[ ! -f "$TOOL" ]]; then
|
|
wget -q "https://github.com/AppImage/appimagetool/releases/download/continuous/${{ matrix.appimage }}" -O "$TOOL"
|
|
chmod +x "$TOOL"
|
|
fi
|
|
echo "APPIMAGETOOL=$TOOL" >> "$GITHUB_ENV"
|
|
- name: Package Linux ${{ matrix.arch }}
|
|
run: |
|
|
# Keep the jmods-capable JDK the setup action exported; fall back to JAVA_HOME.
|
|
export FROMCHAT_PACKAGING_JDK="${FROMCHAT_PACKAGING_JDK:-$JAVA_HOME}"
|
|
# packageReleaseDeb/rpm are the slow, quiet parts of this invocation (profiled 2026-10-20:
|
|
# ~45s/~23s single-threaded jpackage compression) — candidates for parallel-invocation
|
|
# packaging if we ever want to shorten this leg.
|
|
./gradlew :app:desktop:packageReleaseLinux -PdesktopArch=${{ matrix.arch }} --no-daemon --console=plain
|
|
- uses: actions/upload-artifact@v5
|
|
with:
|
|
name: linux-${{ matrix.arch }}
|
|
path: |
|
|
app/desktop/build/distributions/release/*-linux-${{ matrix.arch }}.deb
|
|
app/desktop/build/distributions/release/*-linux-${{ matrix.arch }}.rpm
|
|
app/desktop/build/distributions/release/*-linux-${{ matrix.arch }}.AppImage
|
|
if-no-files-found: error
|
|
- uses: ./.github/actions/save-gradle-build-cache
|
|
if: always()
|
|
with:
|
|
scope: ${{ steps.gradle-build-cache.outputs.cache-save-scope }}
|
|
|
|
android:
|
|
name: Android
|
|
needs: resolve-version
|
|
if: needs.resolve-version.outputs.should_build == 'true'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: ./.github/actions/restore-git-mtimes
|
|
- uses: ./.github/actions/set-version
|
|
with:
|
|
version: ${{ needs.resolve-version.outputs.version }}
|
|
- uses: ./.github/actions/setup-java-gradle
|
|
with:
|
|
cache-read-only: "true"
|
|
- uses: android-actions/setup-android@v4
|
|
- uses: ./.github/actions/cache-gradle-build
|
|
id: gradle-build-cache
|
|
with:
|
|
scope: android
|
|
- name: Prepare Android SDK cache dirs
|
|
run: mkdir -p ~/.android/build-cache ~/.android/cache
|
|
- name: Cache Android SDK extras
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: |
|
|
~/.android/build-cache
|
|
~/.android/cache
|
|
key: android-sdk-${{ runner.os }}-${{ hashFiles('gradle/libs.versions.toml', 'app/android/build.gradle.kts') }}
|
|
restore-keys: android-sdk-${{ runner.os }}-
|
|
- name: Prepare Android signing
|
|
env:
|
|
KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
|
|
GOOGLE_SERVICES_JSON: ${{ secrets.ANDROID_GOOGLE_SERVICES_JSON }}
|
|
RELEASE_STORE_PASSWORD: ${{ secrets.ANDROID_RELEASE_STORE_PASSWORD }}
|
|
RELEASE_KEY_PASSWORD: ${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }}
|
|
run: |
|
|
if [[ -z "$KEYSTORE_BASE64" || -z "$GOOGLE_SERVICES_JSON" ]]; then
|
|
echo "Missing ANDROID_KEYSTORE_BASE64 or ANDROID_GOOGLE_SERVICES_JSON secrets" >&2
|
|
exit 1
|
|
fi
|
|
mkdir -p app/android/keys
|
|
printf '%s' "$KEYSTORE_BASE64" | base64 -d > app/android/keys/release.jks
|
|
keytool -genkeypair -noprompt \
|
|
-alias key0 -keyalg RSA -keysize 2048 -validity 10000 \
|
|
-dname "CN=FromChat Debug" \
|
|
-keystore app/android/keys/debug.jks \
|
|
-storepass android -keypass android
|
|
{
|
|
echo "releaseStorePassword=${RELEASE_STORE_PASSWORD}"
|
|
echo "releaseKeyPassword=${RELEASE_KEY_PASSWORD}"
|
|
echo "debugStorePassword=android"
|
|
echo "debugKeyPassword=android"
|
|
} > app/android/keys/keystore.properties
|
|
printf '%s' "$GOOGLE_SERVICES_JSON" | base64 -d > app/android/google-services.json
|
|
- name: Build universal Android APK
|
|
run: ./gradlew :app:android:assembleRelease --no-daemon --console=plain
|
|
- uses: ./.github/actions/save-gradle-build-cache
|
|
if: always()
|
|
with:
|
|
scope: ${{ steps.gradle-build-cache.outputs.cache-save-scope }}
|
|
- name: Stage APK
|
|
run: |
|
|
mkdir -p release-staging
|
|
APK="$(find app/android/build/outputs/apk/release -name '*release*.apk' | head -n 1)"
|
|
cp "$APK" "release-staging/FromChat-${{ needs.resolve-version.outputs.release_label }}.apk"
|
|
- uses: actions/upload-artifact@v5
|
|
with:
|
|
name: android
|
|
path: release-staging/*.apk
|
|
if-no-files-found: error
|
|
|
|
publish:
|
|
if: >-
|
|
always() &&
|
|
github.event.inputs.skip_publish != 'true' &&
|
|
(
|
|
(needs.resolve-version.outputs.should_build == 'true' &&
|
|
!contains(needs.*.result, 'failure') &&
|
|
!contains(needs.*.result, 'cancelled') &&
|
|
!contains(needs.*.result, 'skipped')) ||
|
|
(needs.resolve-version.outputs.should_build != 'true' &&
|
|
needs.resolve-version.outputs.force_update_release == 'true')
|
|
)
|
|
needs:
|
|
- resolve-version
|
|
- windows-package
|
|
- macos
|
|
- linux
|
|
- android
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
sparse-checkout: |
|
|
RELEASE_NOTES.md
|
|
sparse-checkout-cone-mode: false
|
|
# Save the build-success marker before publishing: a later step failing must not cause a
|
|
# re-run to rebuild identical inputs. If the release itself is still missing, decide will
|
|
# rebuild regardless of a marker hit.
|
|
- name: Record successful build
|
|
if: needs.resolve-version.outputs.should_build == 'true'
|
|
run: mkdir -p .release-built-marker && touch .release-built-marker/built
|
|
- uses: actions/cache/save@v5
|
|
if: needs.resolve-version.outputs.should_build == 'true'
|
|
continue-on-error: true
|
|
with:
|
|
path: .release-built-marker
|
|
key: release-built-${{ needs.resolve-version.outputs.tag }}-${{ needs.resolve-version.outputs.inputs_hash }}
|
|
- name: Update release notes only
|
|
if: needs.resolve-version.outputs.should_build != 'true'
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
TAG: ${{ needs.resolve-version.outputs.tag }}
|
|
run: gh release edit "$TAG" --notes-file RELEASE_NOTES.md
|
|
- uses: actions/download-artifact@v5
|
|
if: needs.resolve-version.outputs.should_build == 'true'
|
|
with:
|
|
pattern: "{windows,macos,linux}-*"
|
|
merge-multiple: true
|
|
path: artifacts
|
|
- uses: actions/download-artifact@v5
|
|
if: needs.resolve-version.outputs.should_build == 'true'
|
|
with:
|
|
name: android
|
|
path: artifacts
|
|
- name: Collect release assets
|
|
if: needs.resolve-version.outputs.should_build == 'true'
|
|
env:
|
|
LABEL: ${{ needs.resolve-version.outputs.release_label }}
|
|
run: |
|
|
set -euo pipefail
|
|
if [[ ! -d artifacts ]]; then
|
|
echo "No artifacts were downloaded" >&2
|
|
exit 1
|
|
fi
|
|
mkdir -p release-assets
|
|
|
|
pick_one() {
|
|
local pattern="$1"
|
|
local dest="$2"
|
|
local match
|
|
match=$(find artifacts -type f -name "$pattern" | head -n 1)
|
|
if [[ -z "$match" ]]; then
|
|
echo "Missing artifact matching $pattern" >&2
|
|
exit 1
|
|
fi
|
|
cp "$match" "release-assets/$dest"
|
|
}
|
|
|
|
pick_one "*-windows-x64.exe" "FromChat-${LABEL}-x64.exe"
|
|
pick_one "*-windows-arm64.exe" "FromChat-${LABEL}-arm.exe"
|
|
pick_one "*-macOS-arm64.dmg" "FromChat-${LABEL}-apple.dmg"
|
|
pick_one "*-macOS-x64.dmg" "FromChat-${LABEL}-intel.dmg"
|
|
pick_one "*-linux-x64.deb" "FromChat-${LABEL}-x64.deb"
|
|
pick_one "*-linux-arm64.deb" "FromChat-${LABEL}-arm.deb"
|
|
pick_one "*-linux-x64.rpm" "FromChat-${LABEL}-x64.rpm"
|
|
pick_one "*-linux-arm64.rpm" "FromChat-${LABEL}-arm.rpm"
|
|
pick_one "*-linux-x64.AppImage" "FromChat-${LABEL}-x64.AppImage"
|
|
pick_one "*-linux-arm64.AppImage" "FromChat-${LABEL}-arm.AppImage"
|
|
pick_one "*.apk" "FromChat-${LABEL}.apk"
|
|
|
|
if find release-assets -type f -name '*.zip' | grep -q .; then
|
|
echo "Release assets must not be zip archives" >&2
|
|
exit 1
|
|
fi
|
|
ls -la release-assets
|
|
- name: Publish GitHub Release
|
|
if: needs.resolve-version.outputs.should_build == 'true'
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ needs.resolve-version.outputs.tag }}
|
|
name: ${{ needs.resolve-version.outputs.tag }}
|
|
body_path: RELEASE_NOTES.md
|
|
draft: false
|
|
prerelease: ${{ needs.resolve-version.outputs.prerelease == 'true' }}
|
|
generate_release_notes: false
|
|
# Re-upload assets to an existing release (force_update_release path). Note: the input
|
|
# is literally named overwrite_files; overwrite_existing is not a valid input of this
|
|
# action and used to be silently ignored by GitHub.
|
|
overwrite_files: true
|
|
files: |
|
|
release-assets/FromChat-${{ needs.resolve-version.outputs.release_label }}.apk
|
|
release-assets/FromChat-${{ needs.resolve-version.outputs.release_label }}-x64.exe
|
|
release-assets/FromChat-${{ needs.resolve-version.outputs.release_label }}-arm.exe
|
|
release-assets/FromChat-${{ needs.resolve-version.outputs.release_label }}-apple.dmg
|
|
release-assets/FromChat-${{ needs.resolve-version.outputs.release_label }}-intel.dmg
|
|
release-assets/FromChat-${{ needs.resolve-version.outputs.release_label }}-x64.deb
|
|
release-assets/FromChat-${{ needs.resolve-version.outputs.release_label }}-arm.deb
|
|
release-assets/FromChat-${{ needs.resolve-version.outputs.release_label }}-x64.rpm
|
|
release-assets/FromChat-${{ needs.resolve-version.outputs.release_label }}-arm.rpm
|
|
release-assets/FromChat-${{ needs.resolve-version.outputs.release_label }}-x64.AppImage
|
|
release-assets/FromChat-${{ needs.resolve-version.outputs.release_label }}-arm.AppImage
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|