62 lines
2.1 KiB
YAML
62 lines
2.1 KiB
YAML
name: Build Flatpak
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
tags: [ '*' ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
flatpak:
|
|
name: Build Flatpak
|
|
# Use a VM runner if possible. If using a docker runner, ensure it supports namespaces.
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Flatpak Tools
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y flatpak flatpak-builder
|
|
# Initialize the user installation (safer for CI than system-wide)
|
|
flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
|
|
|
- name: Cache Flatpak Dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.local/share/flatpak
|
|
key: flatpak-${{ runner.os }}-${{ hashFiles('build-aux/com.ranfdev.Notify.Devel.json') }}
|
|
|
|
- name: Install Runtimes
|
|
run: |
|
|
# Extract runtime from your manifest to install it
|
|
# This assumes your manifest defines org.freedesktop.Platform/x86_64/23.08
|
|
# You may need to hardcode this or parse your YAML
|
|
flatpak --user install -y flathub org.freedesktop.Platform//23.08 org.freedesktop.Sdk//23.08
|
|
|
|
- name: Build Flatpak
|
|
run: |
|
|
# --force-clean: Ensures a fresh build
|
|
# --install-deps-from=flathub: Automatically pulls needed libs
|
|
# --repo=repo: Creates a local repo directory for export
|
|
flatpak-builder --force-clean --user --install-deps-from=flathub --repo=repo build-dir build-aux/com.ranfdev.Notify.Devel.json
|
|
|
|
- name: Build Bundle
|
|
run: |
|
|
# Create a single .flatpak file for distribution
|
|
flatpak build-bundle repo my-app.flatpak com.ranfdev.Notify.Devel
|
|
|
|
- name: Validate AppStream
|
|
run: |
|
|
# Optional: Check metadata validity
|
|
flatpak run org.freedesktop.appstream-cli validate --nonet my-app.flatpak || true
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: flatpak-bundle
|
|
path: my-app.flatpak
|