AyuGramDesktop/.github/workflows/flatpak-build.yml
2025-07-22 07:58:23 +03:00

93 lines
No EOL
3.5 KiB
YAML

name: Build AyuGram Flatpak
on:
workflow_dispatch:
jobs:
build-flatpak:
name: Build and package Flatpak
runs-on: self-hosted
steps:
- name: Force clean workspace
run: |
echo "Принудительная очистка рабочей директории..."
sudo rm -rf ./* || true
sudo rm -rf ./.git* || true
- name: Checkout repository with submodules
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Verify that required secrets are set
run: |
if [ -z "${{ secrets.TDESKTOP_API_ID }}" ] || [ -z "${{ secrets.TDESKTOP_API_HASH }}" ]; then
echo "::error:: Обязательные секреты TDESKTOP_API_ID и/или TDESKTOP_API_HASH не найдены или пусты."
echo "::error:: Пожалуйста, проверьте их имена и наличие в Settings -> Secrets and variables -> Actions."
exit 1
else
echo "Секреты успешно найдены."
fi
- name: Install dependencies and Flatpak SDK
run: |
sudo dnf install -y flatpak flatpak-builder python3-pip
pip3 install --user 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
flatpak install --user -y --noninteractive org.gnome.Platform//48
- name: Cache TDesktop Dependencies
id: cache-tdesktop-deps
uses: actions/cache@v4
with:
path: Telegram/ThirdParty
key: ${{ runner.os }}-tdeps-${{ hashFiles('Telegram/build/prepare/dependencies.txt') }}
- 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 \
--cpus="3" \
-u $(id -u):$(id -g) \
-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 -p 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 "Найдена версия: ${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