Skip to content

Build Pinepods Flatpak #31

Build Pinepods Flatpak

Build Pinepods Flatpak #31

Workflow file for this run

name: Build Pinepods Flatpak
on:
workflow_run:
workflows: ["Build Tauri Clients"]
types:
- completed
workflow_dispatch:
inputs:
version:
description: "Version to build (for testing)"
required: true
default: "test"
env:
FLATPAK_ID: com.gooseberrydevelopment.pinepods
jobs:
build-flatpak:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Flatpak
run: |
sudo apt-get update
sudo apt-get install -y flatpak flatpak-builder appstream
- name: Install Flatpak SDK
run: |
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install --user -y flathub org.gnome.Platform//47 org.gnome.Sdk//47
- name: Clone Flathub repo
run: |
git clone https://github.com/flathub/com.gooseberrydevelopment.pinepods flathub-repo
cp flathub-repo/com.gooseberrydevelopment.pinepods.yml .
- name: Set VERSION variable
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
else
# Get version from the successful Tauri build
LATEST_RELEASE=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
echo "VERSION=$LATEST_RELEASE" >> $GITHUB_ENV
fi
- name: Update manifest version and URL
run: |
echo "Updating manifest for version: $VERSION"
sed -i "s|url: .*github.com.*amd64.deb|url: https://github.com/${{ github.repository }}/releases/download/$VERSION/Pinepods_${VERSION}_amd64.deb|" com.gooseberrydevelopment.pinepods.yml
sed -i "s|url: .*github.com.*arm64.deb|url: https://github.com/${{ github.repository }}/releases/download/$VERSION/Pinepods_${VERSION}_arm64.deb|" com.gooseberrydevelopment.pinepods.yml
# Get AMD64 checksum
AMD64_URL="https://github.com/${{ github.repository }}/releases/download/$VERSION/Pinepods_${VERSION}_amd64.deb"
AMD64_SHA256=$(curl -sL "$AMD64_URL" | sha256sum | cut -d' ' -f1)
sed -i "0,/sha256: .*/{s|sha256: .*|sha256: $AMD64_SHA256|}" com.gooseberrydevelopment.pinepods.yml
# Get ARM64 checksum
ARM64_URL="https://github.com/${{ github.repository }}/releases/download/$VERSION/Pinepods_${VERSION}_arm64.deb"
ARM64_SHA256=$(curl -sL "$ARM64_URL" | sha256sum | cut -d' ' -f1)
sed -i "1,/sha256: .*/{s|sha256: .*|sha256: $ARM64_SHA256|}" com.gooseberrydevelopment.pinepods.yml
echo "Updated manifest content:"
cat com.gooseberrydevelopment.pinepods.yml
- name: Get shared Modules
run: |
git clone https://github.com/flathub/shared-modules
# Test build steps
- name: Build and test Flatpak
run: |
flatpak-builder --force-clean --sandbox --user --install-deps-from=flathub --ccache \
--mirror-screenshots-url=https://dl.flathub.org/media/ --repo=repo builddir \
com.gooseberrydevelopment.pinepods.yml
flatpak remote-add --user --no-gpg-verify test-repo "$(pwd)/repo"
flatpak install --user -y test-repo ${{ env.FLATPAK_ID }}
# Basic launch test (timeout after 30s)
timeout 30s flatpak run ${{ env.FLATPAK_ID }} || true
# Verify metainfo
flatpak run --command=cat ${{ env.FLATPAK_ID }} \
/app/share/metainfo/${{ env.FLATPAK_ID }}.metainfo.xml
- name: Create Flatpak bundle
run: |
flatpak build-bundle repo ${{ env.FLATPAK_ID }}.flatpak ${{ env.FLATPAK_ID }}
# Archive everything needed for the Flathub PR
- name: Archive Flatpak files
run: |
mkdir flatpak_output
cp ${{ env.FLATPAK_ID }}.flatpak flatpak_output/
cp com.gooseberrydevelopment.pinepods.yml flatpak_output/
tar -czvf flatpak_files.tar.gz flatpak_output
- name: Upload Flatpak archive
uses: actions/upload-artifact@v4
with:
name: flatpak-files
path: flatpak_files.tar.gz