AyuGramDesktop/.github/workflows/flatpak-build.yml
2025-07-21 09:35:12 +03:00

67 lines
No EOL
2.4 KiB
YAML

name: Build AyuGram Flatpak
on:
workflow_dispatch:
jobs:
build-flatpak:
name: Build and package Flatpak
runs-on: self-hosted
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
submodules: 'recursive'
clean: true
- name: Install dependencies and Flatpak SDK
run: |
sudo dnf install -y flatpak flatpak-builder python3-pip
pip3 install poetry
echo "$HOME/.local/bin" >> $GITHUB_PATH
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install --user -y --noninteractive org.gnome.Sdk//48
- name: Prepare libraries
run: ./Telegram/build/prepare/linux.sh
- name: Build AyuGram binary
env:
TDESKTOP_API_ID: ${{ secrets.TDESKTOP_API_ID }}
TDESKTOP_API_HASH: ${{ secrets.TDESKTOP_API_HASH }}
run: |
docker run --rm \
-u $(id -u) \
-v "$PWD:/usr/src/tdesktop" \
ghcr.io/telegramdesktop/tdesktop/centos_env:latest \
/usr/src/tdesktop/Telegram/build/docker/centos_env/build.sh \
-D TDESKTOP_API_ID=${TDESKTOP_API_ID} \
-D TDESKTOP_API_HASH=${TDESKTOP_API_HASH}
- name: Prepare Flatpak build directory
run: |
mkdir ayugram-flatpak-build
cp out/Release/AyuGram ayugram-flatpak-build/
cp -r docs/assets/flatpak-files/* ayugram-flatpak-build/
- name: Get application version
id: get_version
run: |
APP_VERSION=$(grep '<release version=' docs/assets/flatpak-files/usr/share/metainfo/com.ayugram.desktop.metainfo.xml | sed -n 's/.*version="\([^"]*\)".*/\1/p')
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
echo "Found version: ${APP_VERSION}"
- name: Build Flatpak package
working-directory: ./ayugram-flatpak-build
run: |
rm -rf repo build-dir
flatpak-builder --repo=repo --force-clean --disable-rofiles-fuse build-dir com.ayugram.desktop.yml
flatpak build-bundle repo ayugram-desktop-${{ env.APP_VERSION }}.flatpak com.ayugram.desktop
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ayugram-flatpak-package
path: ayugram-flatpak-build/ayugram-desktop-*.flatpak
retention-days: 15