# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: GPL-2.0-or-later
name: Linux Appimage Package
on:
  pull_request:
    types: [opened, synchronize, reopened]

jobs:
  build:
    name: Linux Appimage Package
    runs-on: ubuntu-latest
    container: ghcr.io/nextcloud/continuous-integration-client-appimage-qt6:client-appimage-el8-6.8.3-1
    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
        with:
          fetch-depth: 1

      - name: Configure, compile and package
        id: build-appimage
        env:
          PR_ID: ${{ github.event.number }}
        run: |
            BUILDNR=${GITHUB_RUN_ID} VERSION_SUFFIX=${GITHUB_HEAD_REF} BUILD_UPDATER=ON DESKTOP_CLIENT_ROOT=`pwd` EXECUTABLE_NAME=nextcloud QT_BASE_DIR=/opt/qt OPENSSL_ROOT_DIR=/usr/local/lib64  /bin/bash -c "./admin/linux/build-appimage.sh"

      - name: Upload AppImage artifact
        id: upload-appimage
        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
        with:
          name: nextcloud-appimage-pr-${{ github.event.number }}
          path: ${{ steps.build-appimage.outputs.APPIMAGE_NAME }}
          overwrite: true
          compression-level: 0 # squashfs is already compressed
