ci: add support for building and attaching desktop distributions to releases

This commit updates the release and promotion workflows to support building desktop binaries for macOS, Windows, and Linux. It introduces a `build_desktop` flag to toggle this functionality and ensures that generated artifacts (DMG, MSI, EXE, DEB, RPM, AppImage) are uploaded and attached to the GitHub release.

Specific changes include:
- **Workflow Inputs**: Added a `build_desktop` boolean input to `promote.yml`, `release.yml`, and `create-or-promote-release.yml`.
- **Desktop Build Job**:
    - Implemented a `release-desktop` job in `promote.yml` using a matrix strategy for `macos-latest`, `windows-latest`, and `ubuntu-24.04`.
    - Added logic to install `libfuse2` on Linux for AppImage support.
    - Configured Gradle to run `:desktop:packageReleaseDistributionForCurrentOS`.
    - Added artifact upload steps for various desktop binary formats.
- **Release Integration**:
    - Updated `update-github-release` and `github-release` jobs to conditionally download desktop artifacts.
    - Modified the GitHub Release CLI command to include desktop binaries in the release assets when `build_desktop` is enabled.
    - Added safety checks (`!cancelled() && !failure()`) to the release jobs to ensure proper execution flow.
- **Workflow Coordination**: Passed the `build_desktop` parameter through the `create-or-promote-release.yml` orchestrator to both the release and promote sub-workflows.

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich
2026-03-26 14:45:49 -05:00
parent 79dad0455a
commit 6170ed06cd
3 changed files with 104 additions and 5 deletions

View File

@@ -20,6 +20,11 @@ on:
required: true
type: boolean
default: false
build_desktop:
description: 'Whether to build the desktop distribution'
required: true
type: boolean
default: false
permissions:
contents: write
@@ -124,6 +129,7 @@ jobs:
tag_name: ${{ needs.determine-tags.outputs.final_tag }}
channel: ${{ inputs.channel }}
base_version: ${{ inputs.base_version }}
build_desktop: ${{ inputs.build_desktop }}
secrets: inherit
call-promote-workflow:
@@ -137,6 +143,7 @@ jobs:
channel: ${{ inputs.channel }}
base_version: ${{ inputs.base_version }}
from_channel: ${{ needs.determine-tags.outputs.from_channel }}
build_desktop: ${{ inputs.build_desktop }}
secrets: inherit
cleanup-on-failure:

View File

@@ -31,6 +31,11 @@ on:
description: 'The channel to promote from'
required: true
type: string
build_desktop:
description: 'Whether to build the desktop distribution'
required: false
type: boolean
default: false
secrets:
GSERVICES:
required: true
@@ -115,9 +120,19 @@ jobs:
to-track: ${{ inputs.channel == 'closed' && 'NewAlpha' || (inputs.channel == 'open' && 'beta' || 'production') }}
user-fraction: ${{ (inputs.channel == 'production' && '0.1') || (inputs.channel == 'open' && '0.5') || '1.0' }}
update-github-release:
runs-on: ubuntu-24.04-arm
needs: [ prepare-build-info, promote-release ]
release-desktop:
if: ${{ inputs.build_desktop }}
runs-on: ${{ matrix.os }}
needs: [ prepare-build-info ]
environment: Release
strategy:
fail-fast: false
matrix:
os: [ macos-latest, windows-latest, ubuntu-24.04, ubuntu-24.04-arm ]
env:
GRADLE_CACHE_URL: ${{ secrets.GRADLE_CACHE_URL }}
GRADLE_CACHE_USERNAME: ${{ secrets.GRADLE_CACHE_USERNAME }}
GRADLE_CACHE_PASSWORD: ${{ secrets.GRADLE_CACHE_PASSWORD }}
steps:
- name: Checkout code
uses: actions/checkout@v6
@@ -126,6 +141,68 @@ jobs:
fetch-depth: 0
submodules: 'recursive'
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
java-version: '17'
distribution: 'temurin'
token: ${{ github.token }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
with:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
build-scan-publish: true
build-scan-terms-of-use-url: 'https://gradle.com/terms-of-service'
build-scan-terms-of-use-agree: 'yes'
- name: Install dependencies for AppImage
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libfuse2
- name: Package Native Distributions
env:
ORG_GRADLE_PROJECT_appVersionName: ${{ needs.prepare-build-info.outputs.APP_VERSION_NAME }}
APPIMAGE_EXTRACT_AND_RUN: 1
run: ./gradlew :desktop:packageReleaseDistributionForCurrentOS --no-daemon
- name: List Desktop Binaries
if: runner.os == 'Linux'
run: ls -R desktop/build/compose/binaries/main-release
- name: Upload Desktop Artifacts
if: always()
uses: actions/upload-artifact@v7
with:
name: desktop-${{ runner.os }}-${{ runner.arch }}
path: |
desktop/build/compose/binaries/main-release/*/*.dmg
desktop/build/compose/binaries/main-release/*/*.msi
desktop/build/compose/binaries/main-release/*/*.exe
desktop/build/compose/binaries/main-release/*/*.deb
desktop/build/compose/binaries/main-release/*/*.rpm
desktop/build/compose/binaries/main-release/*/*.AppImage
retention-days: 1
if-no-files-found: ignore
update-github-release:
if: ${{ !cancelled() && !failure() }}
runs-on: ubuntu-24.04-arm
needs: [ prepare-build-info, promote-release, release-desktop ]
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
ref: ${{ inputs.commit_sha || inputs.tag_name }}
fetch-depth: 0
submodules: 'recursive'
- name: Download Desktop Artifacts
if: ${{ inputs.build_desktop }}
uses: actions/download-artifact@v8
with:
path: ./artifacts
- name: Push Git Tag on Success
if: ${{ inputs.commit_sha != '' }}
run: |
@@ -136,10 +213,18 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release edit ${{ inputs.tag_name }} \
# Construct base command
CMD=(gh release edit ${{ inputs.tag_name }} \
--tag ${{ inputs.final_tag }} \
--title "${{ inputs.release_name }} (${{ needs.prepare-build-info.outputs.APP_VERSION_CODE }})" \
--prerelease=${{ inputs.channel != 'production' }}
--prerelease=${{ inputs.channel != 'production' }})
# Add artifacts if build_desktop was true
if [ "${{ inputs.build_desktop }}" == "true" ]; then
CMD+=(--files "./artifacts/**/*")
fi
"${CMD[@]}"
- name: Notify Discord
if: ${{ inputs.channel != 'internal' }}

View File

@@ -19,6 +19,11 @@ on:
description: 'The channel to create a release for or promote to'
required: true
type: string
build_desktop:
description: 'Whether to build the desktop distribution'
required: false
type: boolean
default: false
secrets:
GSERVICES:
required: true
@@ -270,6 +275,7 @@ jobs:
subject-path: app/build/outputs/apk/fdroid/release/*.apk
release-desktop:
if: ${{ inputs.build_desktop }}
runs-on: ${{ matrix.os }}
needs: [prepare-build-info]
environment: Release
@@ -334,6 +340,7 @@ jobs:
if-no-files-found: ignore
github-release:
if: ${{ !cancelled() && !failure() }}
runs-on: ubuntu-24.04-arm
needs: [prepare-build-info, release-google, release-fdroid, release-desktop]
env: