diff --git a/.github/workflows/create-or-promote-release.yml b/.github/workflows/create-or-promote-release.yml index 0d5877270..85940597a 100644 --- a/.github/workflows/create-or-promote-release.yml +++ b/.github/workflows/create-or-promote-release.yml @@ -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: diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml index 2338a6aeb..0fb3ca837 100644 --- a/.github/workflows/promote.yml +++ b/.github/workflows/promote.yml @@ -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' }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e03e9618a..4b7f6f4b9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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: